-
Notifications
You must be signed in to change notification settings - Fork 1
Description
If a document with multiple Schema violations is validated, the ErrorLogger returns an array of arrays, which is not properly parsed. Rather than the actual error message, each error is shown as "[object Object]"
Example: https://github.com/SMPTE/st2098-2-private/actions/runs/17082594180/job/48439878308
Error: SMPTE schema validation failed:
[object Object]
[object Object]
at main (file:///home/runner/work/st2098-2-private/st2098-2-private/tooling/scripts/build.mjs:740:11)
at file:///home/runner/work/st2098-2-private/st2098-2-private/tooling/scripts/build.mjs:867:1
at ModuleJob.run (node:internal/modules/esm/module_job:263:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:540:24)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
Error: Process completed with exit code 1.
Here is the broken code, in build.mjs around line 740:
const docMetadata = smpteValidate(dom.window.document, logger);
if (logger.hasFailed())
throw Error(SMPTE schema validation failed:\n${logger.errorList().join("\n")});
This errorList() array is filled with 2-field arrays for each error (validate.mjs, line 36):
error(msg, element) {
this.hasFailed_ = true;
this.errors_.push({ "message": msg, "element": element === undefined ? null : element });
}
To properly show the errors, each member of errorList() has to be evaluated for their 'message' and 'element' members. This probably worked for single errors, since join() just joins the two members of the only array.