mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33:01 -06:00
Report errors on downStream
This commit is contained in:
parent
45d721da55
commit
eaa77c0309
|
|
@ -91,11 +91,9 @@ class CallUpload {
|
|||
const talkgroup = parseInt(reqBody.talkgroup, 10) || null;
|
||||
|
||||
if (!this.controller.validateApiKey(apiKey, system, talkgroup)) {
|
||||
const message = `system=${system} talkgroup=${talkgroup} file=${audioName} No matching system/talkgroup`;
|
||||
console.warn(`Api: system=${system} talkgroup=${talkgroup} file=${audioName} No matching system/talkgroup`);
|
||||
|
||||
console.warn(`Api: ${message}`);
|
||||
|
||||
res.send(`${message}\n`);
|
||||
res.sendStatus(403);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -117,7 +115,9 @@ class CallUpload {
|
|||
res.send(`Call imported successfully.\n`);
|
||||
|
||||
} catch (error) {
|
||||
res.status(500).send(error.message);
|
||||
console.error(`Api: system=${system} talkgroup=${talkgroup} file=${audioName} ${error.message}`);
|
||||
|
||||
res.sendStatus(500);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -403,15 +403,10 @@ class Controller extends EventEmitter {
|
|||
|
||||
let newCall;
|
||||
|
||||
try {
|
||||
newCall = await this.models.call.create(call);
|
||||
|
||||
console.log(`NewCall: system=${call.system} talkgroup=${call.talkgroup} file=${call.audioName} Success`);
|
||||
|
||||
} catch (error) {
|
||||
console.log(`NewCall: system=${call.system} talkgroup=${call.talkgroup} file=${call.audioName} ${error.message}`);
|
||||
}
|
||||
|
||||
this.emit('call', newCall);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -136,14 +136,17 @@ class Downstream {
|
|||
form.append('system', call.system);
|
||||
form.append('talkgroup', call.talkgroup);
|
||||
|
||||
form.submit(apiUrl, (error) => {
|
||||
form.submit(apiUrl, (error, response) => {
|
||||
const message = `Downstream: system=${call.system} talkgroup=${call.talkgroup} file=${call.audioName} to=${downstream.url}`;
|
||||
|
||||
if (error) {
|
||||
console.log(`Downstream: system=${call.system} talkgroup=${call.talkgroup} `
|
||||
+ `file=${call.audioName} to=${downstream.url} ${error.message}`);
|
||||
console.error(`${message} ${error.message}`);
|
||||
|
||||
} else if (response.statusCode !== 200) {
|
||||
console.error(`${message} ${response.statusMessage}`);
|
||||
|
||||
} else {
|
||||
console.log(`Downstream: system=${call.system} talkgroup=${call.talkgroup} `
|
||||
+ `file=${call.audioName} to=${downstream.url} Success`);
|
||||
console.log(`${message} Success`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue