| |||||||||||||||||||
| |||||||||||||||||||
| |||||||||||||||||||
| Description | |||||||||||||||||||
Python low-level exception handling Written by John Goerzen, jgoerzen@complete.org | |||||||||||||||||||
| Synopsis | |||||||||||||||||||
| |||||||||||||||||||
| Types | |||||||||||||||||||
| data PyException | |||||||||||||||||||
| |||||||||||||||||||
| General Catching | |||||||||||||||||||
| catchPy :: IO a -> (PyException -> IO a) -> IO a | |||||||||||||||||||
Execute the given IO action. If it raises a PyException, then execute the supplied handler and return its return value. Otherwise, process as normal. | |||||||||||||||||||
| handlePy :: (PyException -> IO a) -> IO a -> IO a | |||||||||||||||||||
| Like catchPy, with the order of arguments reversed. | |||||||||||||||||||
| pyExceptions :: Exception -> Maybe PyException | |||||||||||||||||||
| Useful as the first argument to catchJust, tryJust, or handleJust. Return Nothing if the given exception is not a PyException, or the exception otherwise. | |||||||||||||||||||
| Catching of specific Python exceptions | |||||||||||||||||||
| catchSpecificPy :: PyObject -> IO a -> (PyException -> IO a) -> IO a | |||||||||||||||||||
| Like catchPy, but catches only instances of the Python class given (see doesExceptionMatch). | |||||||||||||||||||
| Exception Object Operations | |||||||||||||||||||
| formatException :: PyException -> IO PyException | |||||||||||||||||||
When an exception is thrown, it is not immediately formatted. This call will format it. | |||||||||||||||||||
| doesExceptionMatch :: PyException -> PyObject -> IO Bool | |||||||||||||||||||
| Returns true if the passed PyException matches the given Python exception class or one of its subclasses. Standard Python exception classes are given in ExcTypes. | |||||||||||||||||||
| Re-Raising Exceptions | |||||||||||||||||||
| exc2ioerror :: PyException -> IO a | |||||||||||||||||||
| A handler for use in catchPy or handlePy. Grabs the Python exception, describes it, and raises the description in the IO monad with fail. | |||||||||||||||||||
| Produced by Haddock version 0.6 | |||||||||||||||||||