Fix error handling in Graph API endpoints - use 502 status and add logging
This commit is contained in:
+3
-2
@@ -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<string, string> = {};
|
||||
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<string, string> = {
|
||||
'Content-Type': 'application/pdf',
|
||||
|
||||
Reference in New Issue
Block a user