errorMessage

Gets the text of the error message from the last function called.

Synopsis

errorMessage()

Return Value

Returns the current error message.

Description

If the current error type is positive then the last error message set is returned. It does not matter if the error message was printed or not. The current error type is the number returned by errorType. If the current error type is zero then None is returned.

Example

This example retrieves the error message from a call to gamma with an illegal argument. Error stopping is turned off so that the example continues beyond the terminal error.

from __future__ import print_function
from pyimsl.math.free import free
from pyimsl.util.ImslError import ImslError
from pyimsl.math.gamma import gamma
from pyimsl.math.errorMessage import errorMessage
from pyimsl.math.errorType import errorType
from pyimsl.math.errorOptions import errorOptions
from pyimsl.math.errorCode import errorCode
try:
    gamma(0.0)
except ImslError:
    msg = errorMessage()
    type = errorType()
    print("type = %d\ncode = %d\n" % (errorType(), errorCode()))
    print("msg = %s\n" % (msg))

Output

***
*** Terminal error issued from IMSL function lGamma:
*** The argument for the function can not be zero.
***
type = 5
code = 9024

msg = The argument for the function can not be zero.