Skip to content

Commit

Permalink
feat: added logging
Browse files Browse the repository at this point in the history
  • Loading branch information
ZanyLeonic committed Aug 6, 2024
1 parent 0b2ed85 commit c33ad76
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ app.get('/', async (req, res) => {
const encoder = new dfpwm.Encoder();
const encodedData = encoder.encode(Buffer.concat(buffers, bufferLengths));

console.log(`Successfully constructed message ${msg}`)

if (req.query['wav'] != null) {
res.send(Buffer.concat(buffers, bufferLengths))
} else {
Expand All @@ -28,8 +30,10 @@ app.get('/', async (req, res) => {
} catch (e) {
if (e.code === 'ENOENT') {
const voxLine = e.path.replace(/^.*[\\/]/, "").replace(/\.[^/.]+$/, "");
console.error(`Could not find VOX line; Line "${voxLine}" does not exist.`)
res.status(404).send({ error: "Could not find VOX line", detail: `Line "${voxLine}" does not exist.` });
} else {
console.error(e)
res.status(500).send({ error: "Internal server error", detail: "An internal error has occurred whilst handling your request. Please try again later." })
}
}
Expand Down

0 comments on commit c33ad76

Please sign in to comment.