summaryrefslogtreecommitdiff
path: root/packages/astro-parser/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro-parser/src')
-rw-r--r--packages/astro-parser/src/parse/index.ts2
-rw-r--r--packages/astro-parser/src/utils/error.ts3
2 files changed, 3 insertions, 2 deletions
diff --git a/packages/astro-parser/src/parse/index.ts b/packages/astro-parser/src/parse/index.ts
index 124e125ef..7edb6235c 100644
--- a/packages/astro-parser/src/parse/index.ts
+++ b/packages/astro-parser/src/parse/index.ts
@@ -105,7 +105,7 @@ export class Parser {
}
error({ code, message }: { code: string; message: string }, index = this.index) {
- error(message, {
+ error(this.template, message, {
name: 'ParseError',
code,
source: this.template,
diff --git a/packages/astro-parser/src/utils/error.ts b/packages/astro-parser/src/utils/error.ts
index 00eed866f..a532f07dd 100644
--- a/packages/astro-parser/src/utils/error.ts
+++ b/packages/astro-parser/src/utils/error.ts
@@ -27,6 +27,7 @@ export class CompileError extends Error {
/** Throw CompileError */
export default function error(
+ code: string,
message: string,
props: {
name: string;
@@ -36,7 +37,7 @@ export default function error(
end?: number;
}
): never {
- const err = new CompileError({ message, start: props.start, end: props.end, filename: props.filename });
+ const err = new CompileError({ code, message, start: props.start, end: props.end, filename: props.filename });
err.name = props.name;
throw err;