Class: Strava::Errors::Fault
- Inherits:
-
Faraday::ClientError
- Object
- Faraday::ClientError
- Strava::Errors::Fault
- Defined in:
- lib/strava/errors/fault.rb
Overview
Base error class for Strava API client errors.
This exception is raised when the Strava API returns an error response. It extends Faraday::ClientError and provides convenient access to the error message, response headers, and detailed error information from the API response body.
Instance Method Summary collapse
-
#errors ⇒ Array?
Returns detailed error information from the API response.
-
#headers ⇒ Hash
Returns the HTTP response headers.
-
#message ⇒ String
Returns the error message from the API response.
Instance Method Details
#errors ⇒ Array?
Returns detailed error information from the API response.
The Strava API may return an 'errors' array in the response body containing detailed information about validation errors or other specific error conditions.
46 47 48 |
# File 'lib/strava/errors/fault.rb', line 46 def errors response[:body]['errors'] end |
#headers ⇒ Hash
Returns the HTTP response headers.
33 34 35 |
# File 'lib/strava/errors/fault.rb', line 33 def headers response[:headers] end |
#message ⇒ String
Returns the error message from the API response.
Extracts the message from the response body if available, otherwise falls back to the parent class message.
24 25 26 |
# File 'lib/strava/errors/fault.rb', line 24 def response[:body]['message'] || super end |