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

message string

The error description.

kind TcgDexErrorKind

What went wrong.

requestUri Uri?

The request that failed, when known.

statusCode HttpStatusCode?

The HTTP status returned, when there was a response.

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.

Kind

What went wrong.

public TcgDexErrorKind Kind { get; }

Property Value

TcgDexErrorKind

Problem

The parsed error body, when the API returned one that could be read.

public TcgDexProblem? Problem { get; }

Property Value

TcgDexProblem?

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; }

Property Value

HttpStatusCode?