Skip to content

Commit

Permalink
syntax error message more verbose
Browse files Browse the repository at this point in the history
made the syntax error when validating a dictionary also provide the name of the term bank that contains the error
  • Loading branch information
austinyu12 committed Oct 6, 2024
1 parent 2bc442f commit 3a2fe16
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ext/js/dictionary/dictionary-importer.js
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,19 @@ export class DictionaryImporter {
const results = [];
for (const file of files) {
const content = await this._getData(file, new TextWriter());
/** @type {unknown} */
const entries = parseJson(content);
let entries;

try {
/** @type {unknown} */
entries = parseJson(content);
}

Check failure on line 823 in ext/js/dictionary/dictionary-importer.js

View workflow job for this annotation

GitHub Actions / Static Analysis

Closing curly brace does not appear on the same line as the subsequent block
catch (error) {
if (error instanceof Error) {
let newError = new Error(error.message + `. Dictionary has invalid data in '${file.filename}'`);

Check failure on line 826 in ext/js/dictionary/dictionary-importer.js

View workflow job for this annotation

GitHub Actions / Static Analysis

'newError' is never reassigned. Use 'const' instead
console.error(newError);

Check failure on line 827 in ext/js/dictionary/dictionary-importer.js

View workflow job for this annotation

GitHub Actions / Static Analysis

Unexpected console statement
throw newError;
}
}

startIndex = progressData.index;
this._progress();
Expand Down

0 comments on commit 3a2fe16

Please sign in to comment.