Class: Strava::Errors::UploadError
- Inherits:
-
Faraday::ClientError
- Object
- Faraday::ClientError
- Strava::Errors::UploadError
- Defined in:
- lib/strava/errors/upload_error.rb
Overview
Exception raised when an activity upload fails.
When uploading activity files (FIT, TCX, GPX) to Strava, the API processes the file asynchronously and may encounter errors during processing. This exception is raised when the upload fails, and includes information about the upload status and error details.
The error provides access to the upload model, which contains detailed information about what went wrong during the upload processing.
Instance Method Summary collapse
-
#error_status ⇒ String
Returns the upload processing status from the response.
-
#headers ⇒ Hash
Returns the HTTP response headers.
-
#message ⇒ String
Returns the error message from the upload response.
-
#status ⇒ Integer
Returns the HTTP response status code.
-
#upload ⇒ Strava::Models::Upload
Returns the upload model containing detailed upload information.
Instance Method Details
#error_status ⇒ String
Returns the upload processing status from the response.
The upload status indicates where in the processing pipeline the upload failed (e.g., 'error', 'processing', 'ready').
58 59 60 |
# File 'lib/strava/errors/upload_error.rb', line 58 def error_status body[:status] end |
#headers ⇒ Hash
Returns the HTTP response headers.
34 35 36 |
# File 'lib/strava/errors/upload_error.rb', line 34 def headers response[:headers] end |
#message ⇒ String
Returns the error message from the upload response.
Extracts the error message from the response body's 'error' field, or falls back to the parent class message if not available.
46 47 48 |
# File 'lib/strava/errors/upload_error.rb', line 46 def body[:error] || super end |
#status ⇒ Integer
Returns the HTTP response status code.
25 26 27 |
# File 'lib/strava/errors/upload_error.rb', line 25 def status response[:status] end |
#upload ⇒ Strava::Models::Upload
Returns the upload model containing detailed upload information.
The upload model includes fields like id, external_id, error, status, and activity_id (if the upload succeeded before encountering an error).
71 72 73 |
# File 'lib/strava/errors/upload_error.rb', line 71 def upload @upload ||= Strava::Models::Upload.new(body) end |