Handling PARI errors

AUTHORS:

exception cypari2.handle_error.PariError

Error raised by PARI

errdata()

Return the error data (a t_ERROR gen) corresponding to this error.

EXAMPLES:

>>> import cypari2
>>> pari = cypari2.Pari()
>>> try:
...     pari('Mod(2,6)')**-1
... except PariError as e:
...     E = e.errdata()
>>> E
error("impossible inverse in Fp_inv: Mod(2, 6).")
>>> E.component(2)
Mod(2, 6)
errnum()

Return the PARI error number corresponding to this exception.

EXAMPLES:

>>> import cypari2
>>> pari = cypari2.Pari()
>>> try:
...     pari('1/0')
... except PariError as err:
...     print(err.errnum())
31
errtext()

Return the message output by PARI when this error occurred.

EXAMPLES:

>>> import cypari2
>>> pari = cypari2.Pari()
>>> try:
...     pari('pi()')
... except PariError as e:
...     print(e.errtext())
not a function in function call