Exception: Coolsms::RestApi::ResponseError
- Inherits:
-
RequestError
- Object
- StandardError
- Error
- Error
- RequestError
- Coolsms::RestApi::ResponseError
- Defined in:
- lib/coolsms/rest_api/errors.rb
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.
Attributes inherited from Error
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = nil, cause = $!) ⇒ ResponseError
constructor
A new instance of ResponseError.
Constructor Details
#initialize(message = nil, cause = $!) ⇒ ResponseError
Returns a new instance of ResponseError.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/coolsms/rest_api/errors.rb', line 43 def initialize( = nil, cause = $!) res = res = .delete(:response) if .is_a?(Hash) && [:response] case res when Faraday::Response then self.status = res.status self.headers = res.headers self.body = res.body when Faraday::Env then self.status = res.status self.headers = res.response_headers self.body = res.body when Faraday::Error::ClientError then self.status = res[:status] self.headers = res[:headers] self.body = res[:body] end super(, cause) end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
41 42 43 |
# File 'lib/coolsms/rest_api/errors.rb', line 41 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
41 42 43 |
# File 'lib/coolsms/rest_api/errors.rb', line 41 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
41 42 43 |
# File 'lib/coolsms/rest_api/errors.rb', line 41 def status @status end |
Class Method Details
.http_status ⇒ Object
38 |
# File 'lib/coolsms/rest_api/errors.rb', line 38 def http_status; 500 end |
.status ⇒ Object
37 |
# File 'lib/coolsms/rest_api/errors.rb', line 37 def status; 31000500 end |