Exception: Bond::BondError

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ BondError

Returns a new instance of BondError.

Parameters:

  • message (String)


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

def initialize(message)
  super(message)
end

Instance Attribute Details

#application_error_codeObject (readonly)

Returns the value of attribute application_error_code.



3
4
5
# File 'lib/bond/errors.rb', line 3

def application_error_code
  @application_error_code
end

#http_codeObject (readonly)

Returns the value of attribute http_code.



3
4
5
# File 'lib/bond/errors.rb', line 3

def http_code
  @http_code
end

Class Method Details

.handle_errors(json) ⇒ Object

Parameters:

  • json (Hash)


7
8
9
10
11
12
13
# File 'lib/bond/errors.rb', line 7

def handle_errors(json)
  errors = json['errors']
  if errors
    error_message = errors.map { |error| "Code: #{error['code']}. Message: #{error['message']}" }.join(' ')
    raise Bond::BondError.new(error_message)
  end
end