Exception: Mashery::Exception

Inherits:
Exception
  • Object
show all
Defined in:
lib/mashery/exceptions.rb

Class Method Summary collapse

Class Method Details

.create(options = {}) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/mashery/exceptions.rb', line 3

def self.create(options = {})
  case options['code']
  when 1000 then ValidationException.new(options['data'])
  when 1001 then DuplicateObjectException.new("#{options['message']} (JSON-RPC error #{options['code']})")
  else JsonRpcException.new("#{options['message']} (JSON-RPC error #{options['code']})")
  end
end