Python Mapping for Local Exceptions

On this page:

Mapped Python Class

A local Slice exception is mapped to a Python class with the same name. For example:

Slice
module Ice
{
    local exception InitializationException
    {
        ...
    }
}

is mapped to the Python class InitializationException:

Python
class InitializationException(LocalException):
    ...

Base Class for Local Exceptions in Python

All mapped Python classes for local exceptions extend the class Ice.LocalException:

Python
class LocalException(Exception):
    ...

LocalException derives from Ice.Exception, which derives from Python's native Exception class.

Mapping for Local Exception Inheritance in Python

A local Slice exception can extend another Slice exception, which is mapped to class inheritance in Python. For example:

Slice
module M
{
    local exception ErrorBase {}
    local exception ResourceError extends ErrorBase {}
}

is mapped to:

Python
class ErrorBase(Ice.LocalException):
    ...
class ResourceError(ErrorBase):
    ...