Class TcgDexApiException
- Namespace
- TcgDex
- Assembly
- TcgDex.CSharpSdk.dll
Thrown when the TCGdex API returns a failure the caller cannot reasonably treat as an ordinary result.
public sealed class TcgDexApiException : Exception, ISerializableInheritance
Implements
Inherited Members
Remarks
A missing resource is not represented by this exception — the single-item getters return null for that, because asking for a card that does not exist is a normal outcome. This exception means the request itself was wrong or the service failed: an unsupported language, a server error, or a response body that could not be parsed.
Constructors
TcgDexApiException()
Creates an exception with no further detail.
public TcgDexApiException()TcgDexApiException(string)
Creates an exception with a message.
public TcgDexApiException(string message)Parameters
messagestring-
The error description.
TcgDexApiException(string, Exception?)
Creates an exception with a message and underlying cause.
public TcgDexApiException(string message, Exception? innerException)Parameters
TcgDexApiException(string, TcgDexErrorKind, Uri?, HttpStatusCode?, TcgDexProblem?, Exception?)
Creates an exception classified by what failed, and where.
public TcgDexApiException(string message, TcgDexErrorKind kind, Uri? requestUri, HttpStatusCode? statusCode = null, TcgDexProblem? problem = null, Exception? innerException = null)Parameters
messagestring-
The error description.
kindTcgDexErrorKind-
What went wrong.
requestUriUri?-
The request that failed, when known.
statusCodeHttpStatusCode?-
The HTTP status returned, when there was a response.
problemTcgDexProblem?-
The parsed problem document, when the body contained one.
innerExceptionException?-
The underlying cause, if any.
Properties
IsLanguageError
Whether the failure was an unsupported language rather than a genuine server or request error.
public bool IsLanguageError { get; }Property Value
Remarks
The API reports this as 404, the same status as a missing
resource, so the status code alone cannot distinguish the two.
Kind
What went wrong.
public TcgDexErrorKind Kind { get; }Property Value
Problem
The parsed error body, when the API returned one that could be read.
public TcgDexProblem? Problem { get; }Property Value
RequestUri
The request that failed, when known.
public Uri? RequestUri { get; }Property Value
- Uri?
StatusCode
The HTTP status code the API returned, when there was a response.
public HttpStatusCode? StatusCode { get; }