Table of Contents

Class StravaException

Namespace
Tudormobile.Strava
Assembly
Tudormobile.Strava.dll

Represents errors returned by the Strava API or encountered while calling it. Carries HTTP metadata (status code, raw content, headers) to aid diagnostics and handling.

public class StravaException : Exception, ISerializable
Inheritance
StravaException
Implements
Inherited Members

Constructors

StravaException(string)

Initializes a new instance of the StravaException class with a specified error message.

public StravaException(string message)

Parameters

message string

The message that describes the error.

StravaException(string, Exception)

Initializes a new instance of the StravaException class with a specified error message and inner exception.

public StravaException(string message, Exception innerException)

Parameters

message string

The error message.

innerException Exception

The exception that caused the current exception.

StravaException(string, HttpStatusCode?, string?, IDictionary<string, IEnumerable<string>>?, Exception?)

Initializes a new instance of the StravaException with HTTP metadata and an inner exception.

public StravaException(string message, HttpStatusCode? statusCode, string? content = null, IDictionary<string, IEnumerable<string>>? responseHeaders = null, Exception? innerException = null)

Parameters

message string

The message that describes the error.

statusCode HttpStatusCode?

HTTP status code returned by the API (optional).

content string

Raw response content (optional).

responseHeaders IDictionary<string, IEnumerable<string>>

Response headers snapshot (optional).

innerException Exception

The exception that caused the current exception.

Properties

Content

Raw response content returned by the API (may be JSON error body) when available.

public string? Content { get; }

Property Value

string

ResponseHeaders

Response headers returned by the API. Keys are header names, values are header values. This is a read-only snapshot supplied at construction.

public IReadOnlyDictionary<string, IEnumerable<string>>? ResponseHeaders { get; }

Property Value

IReadOnlyDictionary<string, IEnumerable<string>>

StatusCode

HTTP status code returned by the API, if available.

public HttpStatusCode? StatusCode { get; }

Property Value

HttpStatusCode?

Methods

ToString()

Returns a string representation of the exception including HTTP metadata (status and a trimmed content preview).

public override string ToString()

Returns

string