Exception: Balanced::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Balanced::Error
- Defined in:
- lib/balanced_ach/error.rb
Overview
Custom error class for rescuing from all Balanced errors
Direct Known Subclasses
BadGateway, BadRequest, Conflict, Forbidden, GatewayTimeout, Gone, InternalServerError, MethodNotAllowed, MoreInformationRequired, NotFound, NotImplemented, PaymentRequired, ServiceUnavailable, Unauthorized
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #body ⇒ Object
- #error_message ⇒ Object
-
#initialize(response) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(response) ⇒ Error
Returns a new instance of Error.
7 8 9 10 |
# File 'lib/balanced_ach/error.rb', line 7 def initialize(response) @response = response super end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/balanced_ach/error.rb', line 5 def response @response end |
Instance Method Details
#body ⇒ Object
12 13 14 |
# File 'lib/balanced_ach/error.rb', line 12 def body Utils.hash_with_indifferent_read_access response[:body] end |
#error_message ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/balanced_ach/error.rb', line 16 def set_attrs extra = body[:additional] ? " -- #{body[:additional]}" : "" "#{self.class.name}(#{response[:status]})::#{body[:status]}:: "\ "#{response[:method].to_s.upcase} #{response[:url].to_s}: "\ "#{body[:category_code]}: #{body[:description]} #{extra}" end |