Exception: Starling::Errors::BaseError
- Inherits:
-
StandardError
- Object
- StandardError
- Starling::Errors::BaseError
- Extended by:
- Forwardable
- Defined in:
- lib/starling/errors/base_error.rb
Direct Known Subclasses
Instance Method Summary collapse
- #error ⇒ Object
- #error_description ⇒ Object
-
#initialize(env) ⇒ BaseError
constructor
A new instance of BaseError.
- #message ⇒ Object (also: #to_s)
- #parsed_body ⇒ Object
Constructor Details
#initialize(env) ⇒ BaseError
Returns a new instance of BaseError.
8 9 10 |
# File 'lib/starling/errors/base_error.rb', line 8 def initialize(env) @env = env end |
Instance Method Details
#error ⇒ Object
24 25 26 27 |
# File 'lib/starling/errors/base_error.rb', line 24 def error return unless json? parsed_body['error'] end |
#error_description ⇒ Object
29 30 31 32 |
# File 'lib/starling/errors/base_error.rb', line 29 def error_description return unless json? parsed_body['error_description'] end |
#message ⇒ Object Also known as: to_s
15 16 17 18 19 20 |
# File 'lib/starling/errors/base_error.rb', line 15 def = status.to_s += ": #{body}" if body end |
#parsed_body ⇒ Object
34 35 36 37 38 39 |
# File 'lib/starling/errors/base_error.rb', line 34 def parsed_body return if body.nil? JSON.parse(body) rescue JSON::ParserError nil end |