server: provide readable error when a file requested by the client file is not found

This commit is contained in:
bordun 2020-11-16 19:32:24 +01:00
parent 8381ca7531
commit 4b250fc389
2 changed files with 10 additions and 5 deletions

View file

@ -99,7 +99,11 @@ function httpRoute(req, res) {
res.sendFile(path.resolve(sessionPath + url))
} catch(e) {
// absolute resolution
res.sendFile(path.resolve(url))
try {
res.sendFile(path.resolve(url))
} catch(e) {
console.error(`(ERROR, HTTP) File not found: ${url}`)
}
}
} else if (url.includes('/osc-ping')) {
httpCheck(true)