bramble-parser
Version:
Bramble is a lightweight recursive descent parser that processes .havenfs files, returning a structured Json tree that can be used to construct an in-memory FS representation. The parser is based on line-based grammar, chunk headers, and metadata declarat
25 lines (19 loc) • 606 B
text/typescript
import { ErrorCode } from 'src/common';
import { errorManager } from './errorManager';
export class HavenException extends Error {
public readonly position: Position;
public readonly code: ErrorCode;
constructor(message: string, position: Position, code: ErrorCode) {
super(message);
this.name = 'HavenException';
this.position = position;
this.code = code;
HavenException.cleanStack(this);
errorManager.report(this);
}
static cleanStack(error: Error) {
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(error, this);
}
}
}