Skip to content

Commit

Permalink
Added try catch to file copy
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMayfield committed Jan 2, 2024
1 parent 492373b commit 0cfb802
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/configureValidator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,17 @@ if (process.env.ONTO_URL != undefined) {
if (dir.includes('MessageDefinition') || dir.includes('ObservationDefinition')) {
destination = 'temp/package/examples/' + root + '.json';
}

const resource: any = fs.readFileSync(dir + "/" + file, 'utf8');
const json = getJson(file, resource);
fs.writeFile(destination, jsonminify(json), function (err) {
if (err) {
return console.error(err);
}
});
try {
const resource: any = fs.readFileSync(dir + "/" + file, 'utf8');
const json = getJson(file, resource);
fs.writeFile(destination, jsonminify(json), function (err) {
if (err) {
return console.error(err);
}
});
} catch (e) {
console.error(e.message + ' Directory '+ dir + "/" + file)
}
})
} else {
console.info('INFO Folder not found ' + dir);
Expand Down

0 comments on commit 0cfb802

Please sign in to comment.