More precise error message to DirWatch when failing to import from trunk-recorder

This commit is contained in:
Chrystian Huot 2020-06-03 15:42:14 -04:00
parent dd8e5d16aa
commit ba025dc1e4

View file

@ -132,9 +132,18 @@ class DirWatch {
const system = this.parseRegex(dirWatch.system, filename);
try {
const meta = JSON.parse(this.readFile(filename, 'utf8'));
let meta;
try {
meta = JSON.parse(this.readFile(filename, 'utf8'));
} catch (error) {
console.error(`DirWatch: Error parsing json file ${filename}`);
return;
}
try {
await this.app.controller.importTrunkRecorder(audio, audioName, audioType, system, meta);
if (dirWatch.deleteAfter) {
@ -144,10 +153,15 @@ class DirWatch {
}
} catch (error) {
console.error(`DirWatch: Error loading file ${filename}`);
console.error(`DirWatch: Error importing file ${audioFile}`);
return;
}
} else {
console.error(`DirWatch: Error missing file ${audioFile}`);
return;
}
}
}