treating numpy exceptions inside cython file