Exception: Bento::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/bento/core/error.rb,
lib/bento-sdk.rb

Overview

Custom error class for handling Bento API errors. This class encapsulates the HTTP response and provides a formatted error message for easier debugging and error handling.

Direct Known Subclasses

ArgumentError, ConfigurationError

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.


8
9
10
11
# File 'lib/bento/core/error.rb', line 8

def initialize(response)
  @response = response
  super(formatted_error_message)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.


6
7
8
# File 'lib/bento/core/error.rb', line 6

def response
  @response
end

Class Method Details

.raise_with_response(response) ⇒ Object

Raises an instance of Bento::Error with the given response


14
15
16
# File 'lib/bento/core/error.rb', line 14

def self.raise_with_response(response)
  raise new(response)
end