Module: Triton::RemoteExceptions

Defined in:
lib/triton/remote_exception.rb

Overview

This module “magically” defines any constants as RemoteExceptions, so when the server send back error structures such as:

{"code" => "WidgetInvalid", ...}

it means you can:

begin

...

rescue Triton::RemoteException::WidgetInvalid end

without having to exhaustively define all such exceptions beforehand

Class Method Summary collapse

Class Method Details

.const_missing(name) ⇒ Object



18
19
20
21
# File 'lib/triton/remote_exception.rb', line 18

def self.const_missing(name)
  klass = Class.new(RemoteException)
  RemoteExceptions.const_set(name, klass)
end