PHP Mapping for Local Exceptions

On this page:

Mapped PHP Class

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

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

is mapped to the PHP class InitializationException:

PHP
namespace Ice
{
    class InitializationException extends LocalException
    {
        ...
    }
}

Base Class for Local Exceptions in PHP

All mapped PHP classes for local exceptions extend the class \Ice\LocalException:

PHP
namespace Ice
{
    class LocalException extends Exception
    {
        ...
    }
}

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

Mapping for Local Exception Inheritance in PHP

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

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

is mapped to:

PHP
namespace M
{
    class ErrorBase extends \Ice\LocalException
    {
        ...
    }
    class ResourceError extends ErrorBase
    {
        ...
    }
}