Was ussing errno module instead of local when creating exception.