From 4b250fc38909d3bcd66ebd454ca6e19255e34e22 Mon Sep 17 00:00:00 2001 From: bordun Date: Mon, 16 Nov 2020 19:32:24 +0100 Subject: [PATCH] server: provide readable error when a file requested by the client file is not found --- CHANGELOG.md | 9 +++++---- src/server/server.js | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee5a9f5e..6c1d9ddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,11 +14,12 @@ As of this version, packages except the `node` package are bundled with a midi b - bug fixes - - missing context menu (copy, paste) in inspector inputs - - osc listeners not resolving "auto" address - - `ELECTRON_RUN_AS_NODE` headless mode not working without `--no-gui` option + - editor: missing context menu (copy, paste) in inspector inputs + - widgets: osc listeners not resolving "auto" address + - cli: `ELECTRON_RUN_AS_NODE` headless mode not working without `--no-gui` option - ios: clone widget not laid out properly in horizontal panels - - missing vertical scrollbar when root's height overflows the workspace + - ui: missing vertical scrollbar when root's height overflows the workspace + - server: provide readable error when a file requested by the client file is not found - ui - add console bottom panel with a simple script interpreter diff --git a/src/server/server.js b/src/server/server.js index 133251a3..45c5a301 100644 --- a/src/server/server.js +++ b/src/server/server.js @@ -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)