ErrorType

object ErrorType

Error type constants for JS consumers.

Usage:

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

try {
const card = await api.byScryfallId("invalid-id");
} catch (error) {
if (error.type === ErrorType.NOT_FOUND) {
console.log("Card not found");
}
}

Properties

Link copied to clipboard
const val HTTP_ERROR: String

Other HTTP error

Link copied to clipboard

Invalid request parameters (400)

Link copied to clipboard

Network connectivity error

Link copied to clipboard
const val NOT_FOUND: String

Resource not found (404)

Link copied to clipboard
const val PARSE_ERROR: String

JSON parsing error

Link copied to clipboard
const val RATE_LIMITED: String

Rate limited by Scryfall API (429)

Link copied to clipboard
const val SERVER_ERROR: String

Server error from Scryfall (5xx)

Link copied to clipboard
const val UNKNOWN: String

Unknown error type