Class: Strava::Errors::UploadError

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

Instance Method Details

#error_statusString

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').

Returns:

  • (String)

    The upload status



58
59
60
# File 'lib/strava/errors/upload_error.rb', line 58

def error_status
  body[:status]
end

#headersHash

Returns the HTTP response headers.

Returns:

  • (Hash)

    The response headers hash



34
35
36
# File 'lib/strava/errors/upload_error.rb', line 34

def headers
  response[:headers]
end

#messageString

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.

Returns:

  • (String)

    The error message



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

def message
  body[:error] || super
end

#statusInteger

Returns the HTTP response status code.

Returns:

  • (Integer)

    The HTTP status code



25
26
27
# File 'lib/strava/errors/upload_error.rb', line 25

def status
  response[:status]
end

#uploadStrava::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).

Returns:



71
72
73
# File 'lib/strava/errors/upload_error.rb', line 71

def upload
  @upload ||= Strava::Models::Upload.new(body)
end