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
readonlycode:"SCRIPT_HOST_API_ERROR"='SCRIPT_HOST_API_ERROR'
Defined in: errors/src/script-host.ts:552
Inherited from
ScriptHostErrors.ApiError.code
docs
readonlydocs:"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
readonlyerrorClass:string
Defined in: script-host/src/errors.ts:63
The error class's name.
errorModule
readonlyerrorModule:string
Defined in: script-host/src/errors.ts:61
The error class's module.
fields
readonlyfields:Readonly<Record<string,ScriptApiErrorField>>
Defined in: script-host/src/errors.ts:64
name
readonlyname:"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
staticcode():"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
staticdocs():"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
staticdomain():"script-host"
Defined in: errors/src/script-host.ts:542
Returns
"script-host"
Inherited from
ScriptHostErrors.ApiError.domain
template
Get Signature
get
statictemplate():"{message}"
Defined in: errors/src/script-host.ts:545
Returns
"{message}"
Inherited from
ScriptHostErrors.ApiError.template