« get me outta code hell

write: live-dev-server: better web route file error logging - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/write/build-modes
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-15 21:17:08 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-15 21:17:08 -0300
commit232f2ed5e96c7a605b294a619a8715dd2a9fd682 (patch)
treea14b53833fbf051565f99ba3e75c05209f546307 /src/write/build-modes
parentaeb8c1d4aa11ced91d4228541cd340530c8452f5 (diff)
write: live-dev-server: better web route file error logging
Diffstat (limited to 'src/write/build-modes')
-rw-r--r--src/write/build-modes/live-dev-server.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js
index cb878337..21791da4 100644
--- a/src/write/build-modes/live-dev-server.js
+++ b/src/write/build-modes/live-dev-server.js
@@ -312,12 +312,13 @@ export async function go({
         if (error.code === 'EISDIR') {
           response.writeHead(404, contentTypePlain);
           response.end(`File not found for: ${safePath}`);
+          console.error(`${requestHead} [404] ${pathname} (is directory)`);
         } else {
           response.writeHead(500, contentTypePlain);
           response.end(`Failed during file-to-response pipeline`);
+          console.error(`${requestHead} [500] ${pathname}`);
+          showError(error);
         }
-        console.error(`${requestHead} [500] ${pathname}`);
-        showError(error);
       }
       return;
     }