Table of Contents

Class TcgDexProblem

Namespace
TcgDex.Models
Assembly
TcgDex.CSharpSdk.dll

The error body the API returns for a failed request.

public sealed record TcgDexProblem : IEquatable<TcgDexProblem>

Inheritance

Implements

Inherited Members

Remarks

The live API returns an RFC 9457-shaped problem document — the current specification, which obsoletes RFC 7807; the wire format is unchanged. Note that a 404 does not necessarily mean the resource is missing — an unsupported language also returns 404, with TcgDex.Models.TcgDexProblem.Type ending in language-invalid. Discriminate on TcgDex.Models.TcgDexProblem.Type, not on the status code alone.

The published documentation still describes a simpler {"error": "..."} body. That form was not observed from the live API, but TcgDex.Models.TcgDexProblem.Error captures it should it reappear.

Properties

Details

Additional explanation, such as the list of valid languages.

public string? Details { get; init; }

Property Value

string?

Endpoint

The request path that failed.

public string? Endpoint { get; init; }

Property Value

string?

Error

The message from the legacy error shape, if the API ever returns it.

public string? Error { get; init; }

Property Value

string?

IsLanguageError

Whether this problem reports an unsupported language rather than a missing resource. Both are returned as 404.

public bool IsLanguageError { get; }

Property Value

bool

Lang

The offending language code, on a language error.

public string? Lang { get; init; }

Property Value

string?

Method

The HTTP method used.

public string? Method { get; init; }

Property Value

string?

Status

The HTTP status code, repeated in the body.

public int? Status { get; init; }

Property Value

int?

Title

A human-readable summary of the problem.

public string? Title { get; init; }

Property Value

string?

Type

A URI identifying the error kind, for example https://tcgdex.dev/errors/not-found or https://tcgdex.dev/errors/language-invalid.

public string? Type { get; init; }

Property Value

string?

Methods

Describe()

The best available description of the problem, preferring TcgDex.Models.TcgDexProblem.Details, then TcgDex.Models.TcgDexProblem.Title, then TcgDex.Models.TcgDexProblem.Error.

public string Describe()

Returns

string

A description, or a generic fallback when the body was empty.