Exception: Scale::HttpError
- Inherits:
-
GenericError
- Object
- RuntimeError
- GenericError
- Scale::HttpError
- Defined in:
- lib/scale/http_error.rb
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#original_exception ⇒ Object
readonly
Returns the value of attribute original_exception.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(exception) ⇒ HttpError
constructor
A new instance of HttpError.
Constructor Details
#initialize(exception) ⇒ HttpError
Returns a new instance of HttpError.
5 6 7 8 9 10 |
# File 'lib/scale/http_error.rb', line 5 def initialize(exception) @original_exception = exception @response = Scale.hash(JSON.parse(exception.response.body)) rescue Scale.hash() @status_code = response[:status_code] || e.original_exception.response.code rescue 500 @message = response[:message] || response[:error] end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/scale/http_error.rb', line 3 def @message end |
#original_exception ⇒ Object (readonly)
Returns the value of attribute original_exception.
3 4 5 |
# File 'lib/scale/http_error.rb', line 3 def original_exception @original_exception end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/scale/http_error.rb', line 3 def response @response end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
3 4 5 |
# File 'lib/scale/http_error.rb', line 3 def status_code @status_code end |
Instance Method Details
#code ⇒ Object
12 13 14 |
# File 'lib/scale/http_error.rb', line 12 def code status_code end |