Class: ActiveRpc::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/active_rpc/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, data: nil, message: nil) ⇒ Error

Returns a new instance of Error.



19
20
21
22
23
# File 'lib/active_rpc/errors.rb', line 19

def initialize(code:, data: nil, message: nil)
  @message = message
  @code = code
  @data = data
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



18
19
20
# File 'lib/active_rpc/errors.rb', line 18

def code
  @code
end

#dataObject

Returns the value of attribute data.



17
18
19
# File 'lib/active_rpc/errors.rb', line 17

def data
  @data
end

#messageObject

Returns the value of attribute message.



17
18
19
# File 'lib/active_rpc/errors.rb', line 17

def message
  @message
end

Instance Method Details

#to_hashObject



25
26
27
28
29
30
31
# File 'lib/active_rpc/errors.rb', line 25

def to_hash
  {
    'code' => code,
    'data' => data,
    'message' => message
  }.compact
end