summaryrefslogtreecommitdiff
path: root/src/parser/utils/error.ts
diff options
context:
space:
mode:
authorGravatar Drew Powers <1369770+drwpow@users.noreply.github.com> 2021-04-01 10:25:28 -0600
committerGravatar GitHub <noreply@github.com> 2021-04-01 10:25:28 -0600
commitc26c244ca2634d462616d6cf71072fbe26becba2 (patch)
tree1bd5e83eff9ca88200aacb272c84439f192015ec /src/parser/utils/error.ts
parentf6a7ac67befff863e34133673efb78ea7ac0fe48 (diff)
downloadastro-c26c244ca2634d462616d6cf71072fbe26becba2.tar.gz
astro-c26c244ca2634d462616d6cf71072fbe26becba2.tar.zst
astro-c26c244ca2634d462616d6cf71072fbe26becba2.zip
Annoying Lint PR #2 (#47)
Diffstat (limited to 'src/parser/utils/error.ts')
-rw-r--r--src/parser/utils/error.ts19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/parser/utils/error.ts b/src/parser/utils/error.ts
index 3c1b23e4c..8ebb5b093 100644
--- a/src/parser/utils/error.ts
+++ b/src/parser/utils/error.ts
@@ -16,6 +16,7 @@ export class CompileError extends Error {
}
}
+/** Throw CompileError */
export default function error(
message: string,
props: {
@@ -27,19 +28,19 @@ export default function error(
end?: number;
}
): never {
- const error = new CompileError(message);
- error.name = props.name;
+ const err = new CompileError(message);
+ err.name = props.name;
const start = locate(props.source, props.start, { offsetLine: 1 });
const end = locate(props.source, props.end || props.start, { offsetLine: 1 });
- error.code = props.code;
- error.start = start;
- error.end = end;
- error.pos = props.start;
- error.filename = props.filename;
+ err.code = props.code;
+ err.start = start;
+ err.end = end;
+ err.pos = props.start;
+ err.filename = props.filename;
- error.frame = get_code_frame(props.source, start.line - 1, start.column);
+ err.frame = get_code_frame(props.source, start.line - 1, start.column);
- throw error;
+ throw err;
}