Exception: Fabric::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/fabric/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code = 0, errors = {}) ⇒ Error

Returns a new instance of Error.



17
18
19
20
21
22
# File 'lib/fabric/error.rb', line 17

def initialize(message, code = 0, errors = {})
  super message

  @code = code
  @errors = errors
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



15
16
17
# File 'lib/fabric/error.rb', line 15

def code
  @code
end

#errorsObject (readonly)

Returns the value of attribute errors.



15
16
17
# File 'lib/fabric/error.rb', line 15

def errors
  @errors
end

Instance Method Details

#responseObject



24
25
26
27
28
29
30
# File 'lib/fabric/error.rb', line 24

def response
  Hashie::Mash.new success: false,
                   code: code,
                   result: {},
                   message: message,
                   errors: errors
end