Ruby Mapping for Local Exceptions

On this page:

Mapped Ruby Class

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

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

is mapped to the Ruby class InitializationException:

Ruby
class InitializationException < Ice::LocalException
    ...
end

Base Class for Local Exceptions in Ruby

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

Ruby
class LocalException < Exception
    ...
end

LocalException derives from Ice::Exception, which derives from Ruby's native StandardError class.

Mapping for Local Exception Inheritance in Ruby

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

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

is mapped to:

Ruby
class ErrorBase < Ice::LocalException
    ...
end
class ResourceError < ErrorBase
    ...
end