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
messagestringThe 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
messagestringThe error message.
innerExceptionExceptionThe 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
messagestringThe message that describes the error.
statusCodeHttpStatusCode?HTTP status code returned by the API (optional).
contentstringRaw response content (optional).
responseHeadersIDictionary<string, IEnumerable<string>>Response headers snapshot (optional).
innerExceptionExceptionThe 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
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
StatusCode
HTTP status code returned by the API, if available.
public HttpStatusCode? StatusCode { get; }
Property Value
Methods
ToString()
Returns a string representation of the exception including HTTP metadata (status and a trimmed content preview).
public override string ToString()