Skip to content

API reference / @jsprismarine/errors / JSPrismarineError

JSPrismarineError ​

Classes ​

Interfaces ​

CatalogedError ​

Defined in: packages/errors/src/JSPrismarineError.ts:12

What every catalog error carries besides its message: a stable code, a docs link to the error reference, and the params the message was built from. isJSPrismarineError tells whether a value is one.

Extends ​

  • Error

Properties ​

code ​

readonly code: string

Defined in: packages/errors/src/JSPrismarineError.ts:14

The catalog code, such as LEVELDB_DATABASE_LOCKED. It never changes between releases.

docs ​

readonly docs: string

Defined in: packages/errors/src/JSPrismarineError.ts:16

The address of this error's entry in the error reference.

params ​

readonly params: Readonly<Record<string, unknown>>

Defined in: packages/errors/src/JSPrismarineError.ts:18

The placeholder values the message was built from.

Variables ​

DOCS_URL ​

const DOCS_URL: "https://jsprismarine.dev/" = 'https://jsprismarine.dev/'

Defined in: packages/errors/src/JSPrismarineError.ts:5

Where the documentation is published. Every error links to its entry in the error reference under this address, so a log line leads straight to what the error means.

Functions ​

codeAnchor() ​

codeAnchor(code): string

Defined in: packages/errors/src/JSPrismarineError.ts:104

The anchor the error reference gives a code's heading, as VitePress slugs it.

Parameters ​

code ​

string

Returns ​

string


constantCase() ​

constantCase(name): string

Defined in: packages/errors/src/JSPrismarineError.ts:97

CannotAddToFinishedBlock or native-network as CANNOT_ADD_TO_FINISHED_BLOCK or NATIVE_NETWORK.

Parameters ​

name ​

string

Returns ​

string


docsUrlOf() ​

docsUrlOf(domain, code, module?): string

Defined in: packages/errors/src/JSPrismarineError.ts:110

The address of a code's entry in the error reference. A domain split across modules has a page per module, under the domain's folder.

Parameters ​

domain ​

string

code ​

string

module? ​

string

Returns ​

string


isJSPrismarineError() ​

isJSPrismarineError(value): value is CatalogedError

Defined in: packages/errors/src/JSPrismarineError.ts:84

True for every error the catalog defines, whichever built-in error it extends and whichever installed copy of this package built it. Prefer it to instanceof JSPrismarineError, which misses the entries built on TypeError, RangeError and ReferenceError, and the errors of another copy. A subclass of a category that sets no code, docs and params does not count.

Parameters ​

value ​

unknown

Returns ​

value is CatalogedError