← back to Agent Cabinet
server: wrap /cabinet.yaml route in try/catch so a read error returns 500 instead of crashing
b59c2097e42ceaee046a91d87af54df9e5c680f0 · 2026-05-18 20:09:45 -0700 · SteveStudio2
Files touched
Diff
commit b59c2097e42ceaee046a91d87af54df9e5c680f0
Author: SteveStudio2 <steve@designerwallcoverings.com>
Date: Mon May 18 20:09:45 2026 -0700
server: wrap /cabinet.yaml route in try/catch so a read error returns 500 instead of crashing
---
server.js | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/server.js b/server.js
index 1e21eb6..ca117b7 100644
--- a/server.js
+++ b/server.js
@@ -469,8 +469,14 @@ function renderGame() {
const server = http.createServer((req, res) => {
if (req.url === '/health') { res.writeHead(200); res.end('ok'); return; }
if (req.url === '/cabinet.yaml') {
- res.writeHead(200, { 'Content-Type': 'text/yaml' });
- res.end(fs.readFileSync(CABINET, 'utf8'));
+ try {
+ const yaml = fs.readFileSync(CABINET, 'utf8');
+ res.writeHead(200, { 'Content-Type': 'text/yaml' });
+ res.end(yaml);
+ } catch (e) {
+ res.writeHead(500);
+ res.end(`Could not read cabinet.yaml: ${e.message}`);
+ }
return;
}
if (req.url === '/game' || req.url === '/game/') {
← 6fbc7d5 server: drop dead 'cabinet' param from renderGame (function
·
back to Agent Cabinet
·
snapshot — gitify backup 2026-05-19 1c95831 →