# pythondialog-specific exceptions

## Class hierarchy

Here is the hierarchy of notable exceptions raised by this module:

`error`
`ExecutableNotFound`
`BadPythonDialogUsage`
`PythonDialogSystemError`
`PythonDialogOSError`
`PythonDialogIOError` (should not be raised starting from Python 3.3, as `IOError` becomes an alias of `OSError`)
`PythonDialogErrorBeforeExecInChildProcess`
`PythonDialogReModuleError`
`UnexpectedDialogOutput`
`DialogTerminatedBySignal`
`DialogError`
`UnableToRetrieveBackendVersion`
`UnableToParseBackendVersion`
`UnableToParseDialogBackendVersion`
`InadequateBackendVersion`
`PythonDialogBug`
`ProbablyPythonBug`

As you can see, every exception exc among them verifies:

    issubclass(exc, error)

so if you don’t need fine-grained error handling, simply catch `error` (which will probably be accessible as `dialog.error` from your program) and you should be safe.

Changed in version 2.12: `PythonDialogIOError` is now a subclass of `PythonDialogOSError` in order to help with the transition from `IOError` to `OSError` in the Python language. With this change, you can safely replace `except PythonDialogIOError` clauses with `except PythonDialogOSError` even if running under Python < 3.3.

## Detailed list

exception `dialog.``error`(message=None)

  Base class for exceptions in pythondialog.

exception `dialog.``ExecutableNotFound`(message=None)

  Bases: `dialog.error`

  Exception raised when the dialog executable can’t be found.

exception `dialog.``BadPythonDialogUsage`(message=None)

  Bases: `dialog.error`

  Exception raised when pythondialog is used in an incorrect way.

exception `dialog.``PythonDialogSystemError`(message=None)

  Bases: `dialog.error`

  Exception raised when pythondialog cannot perform a “system operation” (e.g., a system call) that should work in “normal” situations.

  This is a convenience exception: `PythonDialogIOError`, `PythonDialogOSError` and `PythonDialogErrorBeforeExecInChildProcess` all derive from this exception. As a consequence, watching for `PythonDialogSystemError` instead of the aformentioned exceptions is enough if you don’t need precise details about these kinds of errors.

  Don’t confuse this exception with Python’s builtin `SystemError` exception.

exception `dialog.``PythonDialogOSError`(message=None)

  Bases: `dialog.PythonDialogSystemError`

  Exception raised when pythondialog catches an `OSError` exception that should be passed to the calling program.

exception `dialog.``PythonDialogIOError`(message=None)

  Bases: `dialog.PythonDialogOSError`

  Exception raised when pythondialog catches an `IOError` exception that should be passed to the calling program.

  This exception should not be raised starting from Python 3.3, as the built-in exception `IOError` becomes an alias of `OSError`.

  Changed in version 2.12: `PythonDialogIOError` is now a subclass of `PythonDialogOSError` in order to help with the transition from `IOError` to `OSError` in the Python language. With this change, you can safely replace `except PythonDialogIOError` clauses with `except PythonDialogOSError` even if running under Python < 3.3.

exception `dialog.``PythonDialogErrorBeforeExecInChildProcess`(message=None)

  Bases: `dialog.PythonDialogSystemError`

  Exception raised when an exception is caught in a child process before the exec sytem call (included).

  This can happen in uncomfortable situations such as:

  > - the system being out of memory;

  > - the maximum number of open file descriptors being reached;

  > - the dialog-like program being removed (or made non-executable) between the time we found it with `_find_in_path()` and the time the exec system call attempted to execute it;

  > - the Python program trying to call the dialog-like program with arguments that cannot be represented in the user’s locale (`LC_CTYPE`).

exception `dialog.``PythonDialogReModuleError`(message=None)

  Bases: `dialog.PythonDialogSystemError`

  Exception raised when pythondialog catches a `re.error` exception.

exception `dialog.``UnexpectedDialogOutput`(message=None)

  Bases: `dialog.error`

  Exception raised when the dialog-like program returns something not expected by pythondialog.

exception `dialog.``DialogTerminatedBySignal`(message=None)

  Bases: `dialog.error`

  Exception raised when the dialog-like program is terminated by a signal.

exception `dialog.``DialogError`(message=None)

  Bases: `dialog.error`

  Exception raised when the dialog-like program exits with the code indicating an error.

exception `dialog.``UnableToRetrieveBackendVersion`(message=None)

  Bases: `dialog.error`

  Exception raised when we cannot retrieve the version string of the dialog-like backend.

  New in version 2.14.

exception `dialog.``UnableToParseBackendVersion`(message=None)

  Bases: `dialog.error`

  Exception raised when we cannot parse the version string of the dialog-like backend.

  New in version 2.14.

exception `dialog.``UnableToParseDialogBackendVersion`(message=None)

  Bases: `dialog.UnableToParseBackendVersion`

  Exception raised when we cannot parse the version string of the dialog backend.

  New in version 2.14.

exception `dialog.``InadequateBackendVersion`(message=None)

  Bases: `dialog.error`

  Exception raised when the backend version in use is inadequate in a given situation.

  New in version 2.14.

exception `dialog.``PythonDialogBug`(message=None)

  Bases: `dialog.error`

  Exception raised when pythondialog finds a bug in his own code.

exception `dialog.``ProbablyPythonBug`(message=None)

  Bases: `dialog.error`

  Exception raised when pythondialog behaves in a way that seems to indicate a Python bug.