Skip to content

Commit

Permalink
Add schema url to the error output
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlende committed Jun 25, 2024
1 parent 8fb8156 commit e76b51e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions theme-utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,12 @@ async function validateSchema(files) {
process.stdout.write(`${progress} 0/${files.length}`, 'utf-8');
for (let i = 0; i < files.length; i++) {
const filename = files[i];
let schemaURL;
try {
const file = await fs.promises
.readFile(filename, 'utf-8')
.then(JSON.parse);
const schemaURL = file.$schema;
schemaURL = file.$schema;
let schema;
if (!schemaURL) {
schema = {
Expand All @@ -295,7 +296,7 @@ async function validateSchema(files) {
throw ajv.errors;
}
} catch (error) {
errors.push({ file: filename, error });
errors.push({ file: filename, schema: schemaURL ?? 'missing schema', error });
}
progress = progressbar.filledBar(files.length, i + 1)[0];
process.stdout.write(`\r${progress} ${i + 1}/${files.length}`, 'utf-8');
Expand Down

0 comments on commit e76b51e

Please sign in to comment.