Skip to content

Commit

Permalink
fix double line number in parser errors #416
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Dec 11, 2024
1 parent e690935 commit 8f20afb
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![npm](https://img.shields.io/badge/npm-1.0.0%E2%80%93beta.19-blue.svg)](https://www.npmjs.com/package/@jcubic/lips)
![1.0.0 Complete](https://img.shields.io/github/milestones/progress-percent/jcubic/lips/1?label=1.0.0%20Complete)
[![Build and test](https://github.com/jcubic/lips/actions/workflows/build.yaml/badge.svg?branch=devel&event=push)](https://github.com/jcubic/lips/actions/workflows/build.yaml)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&3219dd3e027973c5a1b9dd1dbd079747)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Coverage Status](https://coveralls.io/repos/github/jcubic/lips/badge.svg?branch=devel&57335eab53c7df00260611523df184d0)](https://coveralls.io/github/jcubic/lips?branch=devel)
[![Join Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jcubic/lips)
![NPM Download Count](https://img.shields.io/npm/dm/@jcubic/lips)
![JSDelivr Download count](https://img.shields.io/jsdelivr/npm/hm/@jcubic/lips)
Expand Down
15 changes: 9 additions & 6 deletions dist/lips.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 9 additions & 6 deletions dist/lips.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.esm.min.js

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions dist/lips.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/lips.min.js

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/lips.js
Original file line number Diff line number Diff line change
Expand Up @@ -7565,7 +7565,10 @@ Interpreter.prototype.exec = async function(arg, options = {}) {
this.__parser__.prepare(arg);
return await exec(this.__parser__, { env, dynamic_env, use_dynamic });
} catch(e) {
e.message += ` at line ${this.__parser__.get_line() + 1}`;
if (!e.message?.includes('at line')) {
const location = ` at line ${this.__parser__.get_line() + 1}`;
e.message += location;
}
throw e;
}
}
Expand Down

0 comments on commit 8f20afb

Please sign in to comment.