JsScryfallError

data class JsScryfallError(val type: String, val message: String, val status: Int?, val code: String?, val details: String?, val retryAfterSeconds: Int?, val warnings: Array<String>?)

JavaScript-friendly error representation for Scryfall API errors.

This class wraps Kotlin exceptions into a format that's easy to use from JavaScript.

Usage:

import { JsScryfallError, ErrorType } from '@devmugi/scryfall-api';

try {
const card = await api.byScryfallId("invalid-id");
} catch (error) {
const scryfallError = JsScryfallError.fromError(error);
console.log(`Error type: ${scryfallError.type}`);
console.log(`Message: ${scryfallError.message}`);
if (scryfallError.status) {
console.log(`HTTP Status: ${scryfallError.status}`);
}
}

Constructors

Link copied to clipboard
constructor(type: String, message: String, status: Int?, code: String?, details: String?, retryAfterSeconds: Int?, warnings: Array<String>?)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val code: String?

Scryfall error code (if available)

Link copied to clipboard

Detailed error description from Scryfall

Link copied to clipboard

Human-readable error message

Link copied to clipboard

Retry-after seconds for rate limiting (if applicable)

Link copied to clipboard
val status: Int?

HTTP status code (if applicable)

Link copied to clipboard

The error type (see ErrorType constants)

Link copied to clipboard

Any warnings returned by the API