From f2b293ba216fab7c35717674ec09523f8cf80cc6 Mon Sep 17 00:00:00 2001 From: Rene Saarsoo Date: Fri, 25 Dec 2020 19:59:21 +0200 Subject: [PATCH] Expose ValidationError.loc --- src/parser/ValidationError.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/parser/ValidationError.ts b/src/parser/ValidationError.ts index a872b16..fc14e31 100644 --- a/src/parser/ValidationError.ts +++ b/src/parser/ValidationError.ts @@ -1,7 +1,9 @@ import { SourceLocation } from "./tokenizer"; export class ValidationError extends Error { - constructor(msg: string, { row, col }: SourceLocation) { - super(`${msg} at line ${row + 1} char ${col + 1}`); + public loc: SourceLocation; + constructor(msg: string, loc: SourceLocation) { + super(`${msg} at line ${loc.row + 1} char ${loc.col + 1}`); + this.loc = loc; } }