Table of Contents

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, ISerializable

Inheritance

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

message string

The error description.

TcgDexApiException(string, Exception?)

Creates an exception with a message and underlying cause.

public TcgDexApiException(string message, Exception? innerException)

Parameters

message string

The error description.

innerException Exception?

The underlying cause.

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

message string

The error description.

statusCode HttpStatusCode

The HTTP status returned.

problem TcgDexProblem?

The parsed problem document, when the body contained one.

innerException Exception?

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

bool

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

TcgDexProblem?

StatusCode

The HTTP status code the API returned, when there was a response.

public HttpStatusCode? StatusCode { get; }

Property Value

HttpStatusCode?