Class: Strava::Errors::Fault

Inherits:
Faraday::ClientError
  • Object
show all
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.

See Also:

  • Faraday::ClientError

Instance Method Summary collapse

Instance Method Details

#errorsArray?

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.

Returns:

  • (Array, nil)

    Array of error details, or nil if not present



46
47
48
# File 'lib/strava/errors/fault.rb', line 46

def errors
  response[:body]['errors']
end

#headersHash

Returns the HTTP response headers.

Returns:

  • (Hash)

    The response headers hash



33
34
35
# File 'lib/strava/errors/fault.rb', line 33

def headers
  response[:headers]
end

#messageString

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.

Returns:

  • (String)

    The error message



24
25
26
# File 'lib/strava/errors/fault.rb', line 24

def message
  response[:body]['message'] || super
end