Exception: Tomba::Exception

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tomba/exception.rb

Overview

Custom exception class for Tomba API errors.

Raised when the API returns an error response or when required parameters are missing.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code = nil, response = nil) ⇒ Exception

Returns a new instance of Exception.

Parameters:

  • message (String)

    the error message

  • code (Integer, nil) (defaults to: nil)

    the HTTP status code or error code

  • response (Hash, nil) (defaults to: nil)

    the full error response body



15
16
17
18
19
# File 'lib/tomba/exception.rb', line 15

def initialize(message, code = nil, response = nil)
  super(message)
  @code = code
  @response = response
end

Instance Attribute Details

#codeInteger? (readonly)

the HTTP status code or error code

Returns:

  • (Integer, nil)

    the current value of code



11
12
13
# File 'lib/tomba/exception.rb', line 11

def code
  @code
end

#responseHash? (readonly)

the full error response body

Returns:

  • (Hash, nil)

    the current value of response



11
12
13
# File 'lib/tomba/exception.rb', line 11

def response
  @response
end