Skip to content

API reference / @jsprismarine/script-host / errors / ScriptApiError

Class: ScriptApiError ​

Defined in: script-host/src/errors.ts:58

Thrown by a member's implementation to throw one of the API's own error classes in the script, such as LocationInUnloadedChunkError, with the fields its properties read.

Extends ​

  • ApiError

Constructors ​

Constructor ​

new ScriptApiError(errorModule, errorClass, message, fields?): ScriptApiError

Defined in: script-host/src/errors.ts:72

Parameters ​

errorModule ​

string

The module that declares the error class, such as @minecraft/server.

errorClass ​

string

The error class, such as LocationInUnloadedChunkError.

message ​

string

The message the script sees.

fields? ​

Readonly<Record<string, ScriptApiErrorField>> = {}

Values for the error's properties.

Returns ​

ScriptApiError

Overrides ​

ScriptHostErrors.ApiError.constructor

Properties ​

code ​

readonly code: "SCRIPT_HOST_API_ERROR" = 'SCRIPT_HOST_API_ERROR'

Defined in: errors/src/script-host.ts:552

Inherited from ​

ScriptHostErrors.ApiError.code


docs ​

readonly docs: "https://jsprismarine.dev/errors/script-host#script-host-api-error" = 'https://jsprismarine.dev/errors/script-host#script-host-api-error'

Defined in: errors/src/script-host.ts:553

Inherited from ​

ScriptHostErrors.ApiError.docs


errorClass ​

readonly errorClass: string

Defined in: script-host/src/errors.ts:63

The error class's name.


errorModule ​

readonly errorModule: string

Defined in: script-host/src/errors.ts:61

The error class's module.


fields ​

readonly fields: Readonly<Record<string, ScriptApiErrorField>>

Defined in: script-host/src/errors.ts:64


name ​

readonly name: "ScriptApiError" = 'ScriptApiError'

Defined in: script-host/src/errors.ts:59

Overrides ​

ScriptHostErrors.ApiError.name

Accessors ​

[cataloged] ​

Get Signature ​

get [cataloged](): true

Defined in: errors/src/JSPrismarineError.ts:40

Returns ​

true

Inherited from ​

ScriptHostErrors.ApiError.[cataloged]


params ​

Get Signature ​

get params(): object & Readonly<Record<string, unknown>>

Defined in: errors/src/script-host.ts:562

The placeholder values the message was built from.

Returns ​

object & Readonly<Record<string, unknown>>

Inherited from ​

ScriptHostErrors.ApiError.params


code ​

Get Signature ​

get static code(): "SCRIPT_HOST_API_ERROR"

Defined in: errors/src/script-host.ts:539

Returns ​

"SCRIPT_HOST_API_ERROR"

Inherited from ​

ScriptHostErrors.ApiError.code


docs ​

Get Signature ​

get static docs(): "https://jsprismarine.dev/errors/script-host#script-host-api-error"

Defined in: errors/src/script-host.ts:548

Returns ​

"https://jsprismarine.dev/errors/script-host#script-host-api-error"

Inherited from ​

ScriptHostErrors.ApiError.docs


domain ​

Get Signature ​

get static domain(): "script-host"

Defined in: errors/src/script-host.ts:542

Returns ​

"script-host"

Inherited from ​

ScriptHostErrors.ApiError.domain


template ​

Get Signature ​

get static template(): "{message}"

Defined in: errors/src/script-host.ts:545

Returns ​

"{message}"

Inherited from ​

ScriptHostErrors.ApiError.template