JavaScript Mapping for Local Exceptions

On this page:

Mapped JavaScript Class

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

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

is mapped to the JavaScript class InitializationException:

JavaScript
class InitializationException extends Ice.LocalException
{
    ...
};

Base Class for Local Exceptions in JavaScript

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

JavaScript
class LocalException extends Exception
{
    ...
};

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

Mapping for Local Exception Inheritance in JavaScript

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

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

is mapped to:

JavaScript
class ErrorBase extends Ice.LocalException
{
    ...
};
class ResourceError extends ErrorBase
{
    ...
};