diff options
Diffstat (limited to 'dev/dictionary-validate.js')
| -rw-r--r-- | dev/dictionary-validate.js | 7 | 
1 files changed, 4 insertions, 3 deletions
| diff --git a/dev/dictionary-validate.js b/dev/dictionary-validate.js index 51edcc50..3727310e 100644 --- a/dev/dictionary-validate.js +++ b/dev/dictionary-validate.js @@ -23,6 +23,7 @@ import {performance} from 'perf_hooks';  import {fileURLToPath} from 'url';  import {parseJson} from './json.js';  import {createJsonSchema} from './schema-validate.js'; +import {toError} from './to-error.js';  const dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -47,7 +48,7 @@ async function validateDictionaryBanks(mode, zip, fileNameFormat, schema) {      try {          jsonSchema = createJsonSchema(mode, schema);      } catch (e) { -        const e2 = e instanceof Error ? e : new Error(`${e}`); +        const e2 = toError(e);          e2.message += `\n(in file ${fileNameFormat})}`;          throw e2;      } @@ -62,7 +63,7 @@ async function validateDictionaryBanks(mode, zip, fileNameFormat, schema) {          try {              jsonSchema.validate(data);          } catch (e) { -            const e2 = e instanceof Error ? e : new Error(`${e}`); +            const e2 = toError(e);              e2.message += `\n(in file ${fileName})}`;              throw e2;          } @@ -92,7 +93,7 @@ export async function validateDictionary(mode, archive, schemas) {          const jsonSchema = createJsonSchema(mode, schemas.index);          jsonSchema.validate(index);      } catch (e) { -        const e2 = e instanceof Error ? e : new Error(`${e}`); +        const e2 = toError(e);          e2.message += `\n(in file ${indexFileName})}`;          throw e2;      } |