Skip to main content

ParseError

Type Alias ParseError 

Source
pub type ParseError = SyntaxError;
Expand description

Parser errors share the syntax error type.

Aliased Type§

pub struct ParseError {
    pub message: String,
    pub span: Span,
    pub positionless: bool,
}

Fields§

§message: String

Human readable message (no position prefix).

§span: Span

Where the error happened.

§positionless: bool

Whether the reference reports this error without a position.

Almost every syntax error is printed as SyntaxError: <message> followed by at <file>:<line>:<column>. A handful are not, and the difference is not cosmetic: the reference raises them from js_resolve_module, after parsing has succeeded, so there is no position to give — export {a} with no a prints a bare SyntaxError: exported variable 'a' does not exist. Our parser makes that check itself (it has the declared names in hand), so it has to say “report me like a link error” explicitly.