Class TokenizerError

Extension of SyntaxError that pretty prints error messages, referencing the position in the input script.

Hierarchy

  • SyntaxError
    • TokenizerError

Constructors

  • Parameters

    • message: string
    • raw: string
    • position: number
    • Optionalpath: string

    Returns TokenizerError

Properties

message: string
name: string
path?: string
position: number
raw: string
stack?: string
prepareStackTrace?: ((err: Error, stackTraces: CallSite[]) => any)

Optional override for formatting stack traces

stackTraceLimit: number

Methods

  • Duplicates this TokenizerError.

    Parameters

    • message: string

      An error message

    • Optionalposition: number

      The position of the error

    Returns TokenizerError

    A new TokenizerError that shares raw and path with this instance.

  • Formats the error message for printing.

    Parameters

    • opts: FormatOptions = {}

      Define formatting options

    Returns string

    raw with a caret pointing to the error under the error position.

  • Formats the error message for printing.

    Parameters

    • opts: FormatOptions = {}

      Define formatting options

    Returns string

    raw with a caret pointing to the error under the error position.

    Use format instead. prettyPrint will be removed in a future version.

  • Create .stack property on a target object

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void