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, HttpStatusCode, TcgDexProblem?, Exception?)
Creates an exception describing a failed API response.
public TcgDexApiException(string message, HttpStatusCode statusCode, TcgDexProblem? problem = null, Exception? innerException = null)Parameters
messagestring-
The error description.
statusCodeHttpStatusCode-
The HTTP status returned.
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.
Problem
The parsed error body, when the API returned one that could be read.
public TcgDexProblem? Problem { get; }Property Value
StatusCode
The HTTP status code the API returned, when there was a response.
public HttpStatusCode? StatusCode { get; }