Exception: Lateral::LateralError
- Inherits:
-
StandardError
- Object
- StandardError
- Lateral::LateralError
- Defined in:
- lib/lateral/error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, message) ⇒ LateralError
constructor
A new instance of LateralError.
Constructor Details
#initialize(code, message) ⇒ LateralError
Returns a new instance of LateralError.
5 6 7 8 |
# File 'lib/lateral/error.rb', line 5 def initialize(code, ) super @code = code end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/lateral/error.rb', line 3 def code @code end |
Class Method Details
.from_response(response) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/lateral/error.rb', line 10 def self.from_response(response) = begin JSON.parse(response.body)['message'] rescue JSON::ParserError response.body end new(response.code, ) end |