Interface SNBTParseError<T>

Represents an error that occurred while parsing SNBT.

interface SNBTParseError<T extends boolean = boolean> {
    cause: SNBTParseErrorCause;
    isResolved: T;
    originalInput: T extends true ? string : null;
    getErrorEndPosition(): T extends true
        ? [line: number, column: number]
        : null;
    getErrorPosition(): T extends true ? [line: number, column: number] : null;
    getErrorPositionForStackItem(
        stackItem: SNBTParseErrorCauseStackItem,
    ): [line: number, column: number];
    getErrorPositionWithOffset(
        offset: number,
    ): T extends true ? [line: number, column: number] : null;
}

Type Parameters

  • T extends boolean = boolean

    Whether the error's full stack has been resolved.

Hierarchy

  • Error
    • SNBTParseError

Properties

The cause of the error.

isResolved: T

Whether the error's full stack has been resolved.

originalInput: T extends true ? string : null

The original input that caused the error.

Methods

  • Gets the end position of the error in the input.

    Returns T extends true ? [line: number, column: number] : null

    The end position of the error in the input.

  • Gets the position of the error in the input.

    Returns T extends true ? [line: number, column: number] : null

    The position of the error in the input.

  • Gets the position of the error in the input for a stack item.

    Parameters

    Returns [line: number, column: number]

    The position of the error in the input.

  • Gets the position of the error in the input with an offset.

    Parameters

    • offset: number

      The offset to add to the error position.

    Returns T extends true ? [line: number, column: number] : null

    The position of the error in the input.