From 14327e219d049a4f5249f6b8f3311ab546fb967f Mon Sep 17 00:00:00 2001 From: aewing Date: Wed, 31 Dec 2025 03:06:02 +0000 Subject: [PATCH] Fix error handling in Graph API endpoints - use 502 status and add logging --- backend/server.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/server.ts b/backend/server.ts index cd5236e..e9de023 100644 --- a/backend/server.ts +++ b/backend/server.ts @@ -387,7 +387,8 @@ app.get('/api/job-file-content', async (c) => { }); if (!res.ok) { const text = await res.text(); - return c.json({ error: `Graph ${res.status}: ${text}` }, res.status); + logLine('logs/error.log', `/api/job-file-content failed: ${res.status} - ${text}`); + return c.json({ error: `Graph ${res.status}: ${text}` }, 502); } const headers: Record = {}; const ct = res.headers.get('content-type'); @@ -419,7 +420,7 @@ app.get('/api/job-file-pdf', async (c) => { if (!res.ok) { const text = await res.text(); logLine('logs/error.log', `/api/job-file-pdf conversion failed: ${res.status} - ${text}`); - return c.json({ error: `PDF conversion failed: ${res.status}` }, res.status); + return c.json({ error: `PDF conversion failed: ${res.status}` }, 502); } const headers: Record = { 'Content-Type': 'application/pdf',