Skip to content

PromptScript API


Class: UnexpectedTokenError

Defined in: core/src/errors/parse.ts:17

Unexpected token encountered.

Extends

Constructors

Constructor

new UnexpectedTokenError(token, location, expected?): UnexpectedTokenError

Defined in: core/src/errors/parse.ts:23

Parameters

token

string

location

SourceLocation

expected?

string[]

Returns

UnexpectedTokenError

Overrides

ParseError.constructor

Properties

cause?

readonly optional cause: Error

Defined in: core/src/errors/base.ts:36

Original error if wrapping another error

Inherited from

ParseError.cause


code

readonly code: string

Defined in: core/src/errors/base.ts:32

Error code

Inherited from

ParseError.code


expected?

readonly optional expected: string[]

Defined in: core/src/errors/parse.ts:21

Expected tokens


location?

readonly optional location: SourceLocation

Defined in: core/src/errors/base.ts:34

Source location where error occurred

Inherited from

ParseError.location


token

readonly token: string

Defined in: core/src/errors/parse.ts:19

The unexpected token

Methods

format()

format(): string

Defined in: core/src/errors/base.ts:59

Format error for display.

Returns

string

Inherited from

ParseError.format


toJSON()

toJSON(): Record\<string, unknown>

Defined in: core/src/errors/base.ts:72

Convert to JSON-serializable object.

Returns

Record\<string, unknown>

Inherited from

ParseError.toJSON