Skip to content

Commit

Permalink
remove HetaSyntaxError by HetaLevelError
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Nov 27, 2023
1 parent 5da8351 commit c55a8ec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/module-system/heta-module.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const hetaParser = require('heta-parser');
const HetaLevelError = require('../heta-level-error');

/**
* To initialize a Heta module of the "heta" type.
Expand All @@ -25,13 +26,14 @@ function _hetaParse(...params){
try {
return hetaParser.parse(...params);
} catch(e) {
if((e instanceof hetaParser.SyntaxError)){
e.name = 'HetaParsingError';
if (e instanceof hetaParser.SyntaxError) {
let loc = e.location;
let coord = `${loc.start.line}:${loc.start.column}-${loc.end.line}:${loc.end.column}`;
e.message = `(${coord} in Heta file) ` + e.message;

throw new HetaLevelError(`(${coord} in Heta file) ` + e.message);
} else {
throw e;
}
throw e;
}
}

Expand Down

0 comments on commit c55a8ec

Please sign in to comment.