mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
25 lines
604 B
TypeScript
25 lines
604 B
TypeScript
import type { Position, Token } from 'acorn';
|
|
|
|
export class ExpressionError extends Error {
|
|
/**
|
|
* The location of the error in the parsed expression.
|
|
*/
|
|
public location?: Position | null;
|
|
|
|
/**
|
|
* The expression token with the error
|
|
*/
|
|
public token?: Token;
|
|
|
|
constructor(message: string, loc?: Position | null, token?: Token) {
|
|
super(message);
|
|
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, ExpressionError);
|
|
}
|
|
this.name = 'ExpressionError';
|
|
this.location = loc;
|
|
this.token = token;
|
|
}
|
|
}
|