Exception: Saorin::RPCError

Inherits:
Error
  • Object
show all
Includes:
Dumpable
Defined in:
lib/saorin/error.rb

Direct Known Subclasses

ServerError, UserDefinedError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dumpable

#to_json

Constructor Details

#initialize(message, options = {}) ⇒ RPCError

Returns a new instance of RPCError.



12
13
14
15
16
# File 'lib/saorin/error.rb', line 12

def initialize(message, options = {})
  super message
  @code = options[:code]
  @data = options[:data]
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



10
11
12
# File 'lib/saorin/error.rb', line 10

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



10
11
12
# File 'lib/saorin/error.rb', line 10

def data
  @data
end

Instance Method Details

#to_hObject



18
19
20
21
22
23
24
# File 'lib/saorin/error.rb', line 18

def to_h
  h = {}
  h['code'] = code
  h['message'] = message
  h['data'] = data if data
  h
end