Exception: Escobar::Client::HTTPError
- Inherits:
-
StandardError
- Object
- StandardError
- Escobar::Client::HTTPError
- Defined in:
- lib/escobar/client.rb
Overview
Class for returning API errors to escobar clients
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#status ⇒ Object
Returns the value of attribute status.
Class Method Summary collapse
- .from_error(err) ⇒ Object
- .from_response(resp, message = "Error from Heroku API") ⇒ Object
- .from_response_env(resp, message = "Error from Heroku API") ⇒ Object
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
19 20 21 |
# File 'lib/escobar/client.rb', line 19 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
19 20 21 |
# File 'lib/escobar/client.rb', line 19 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
19 20 21 |
# File 'lib/escobar/client.rb', line 19 def status @status end |
Class Method Details
.from_error(err) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/escobar/client.rb', line 20 def self.from_error(err) error = new("Error from Heroku API") error.body = err.response[:body] error.headers = err.response[:headers] error.status = err.response[:status] error.set_backtrace(err.backtrace) error end |
.from_response(resp, message = "Error from Heroku API") ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/escobar/client.rb', line 41 def self.from_response(resp, = "Error from Heroku API") error = new() error.body = resp.body error.headers = resp.headers error.status = resp.status error end |
.from_response_env(resp, message = "Error from Heroku API") ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'lib/escobar/client.rb', line 31 def self.from_response_env(resp, = "Error from Heroku API") error = new() error.body = resp.body error.headers = resp.response_headers error.status = resp.status error end |