Skip to content

Commit 73793a4

Browse files
authored
syntax error message made more verbose (#1462)
* syntax error message more verbose made the syntax error when validating a dictionary also provide the name of the term bank that contains the error * removed unnecessary error logging and fixed syntax
1 parent 519ffc4 commit 73793a4

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

ext/js/dictionary/dictionary-importer.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,8 +815,16 @@ export class DictionaryImporter {
815815
const results = [];
816816
for (const file of files) {
817817
const content = await this._getData(file, new TextWriter());
818-
/** @type {unknown} */
819-
const entries = parseJson(content);
818+
let entries;
819+
820+
try {
821+
/** @type {unknown} */
822+
entries = parseJson(content);
823+
} catch (error) {
824+
if (error instanceof Error) {
825+
throw new Error(error.message + ` in '${file.filename}'`);
826+
}
827+
}
820828

821829
startIndex = progressData.index;
822830
this._progress();

0 commit comments

Comments
 (0)