many edits

This commit is contained in:
2025-12-19 22:55:48 +00:00
parent 56e1131622
commit 94e5079a60
3 changed files with 244 additions and 34 deletions
+7 -3
View File
@@ -63,7 +63,9 @@ const fetchJson = async (url: string, token: string) => {
});
if (!res.ok) {
const text = await res.text();
throw new Error(`Graph ${res.status}: ${text}`);
const err: any = new Error(`Graph ${res.status}: ${text}`);
err.status = res.status;
throw err;
}
return res.json();
};
@@ -158,8 +160,9 @@ app.get('/api/job-files', async (c) => {
return c.json({ items: mapped, total: mapped.length, source: q ? 'search' : 'walk', driveId });
} catch (err) {
const message = (err as Error)?.message || String(err);
const status = (err as any)?.status || 500;
logLine('logs/error.log', `/api/job-files error: ${message}`);
return c.json({ error: message }, 500);
return c.json({ error: message }, status);
}
});
@@ -187,8 +190,9 @@ app.get('/api/job-file-content', async (c) => {
return new Response(res.body, { status: 200, headers });
} catch (err) {
const message = (err as Error)?.message || String(err);
const status = (err as any)?.status || 500;
logLine('logs/error.log', `/api/job-file-content error: ${message}`);
return c.json({ error: message }, 500);
return c.json({ error: message }, status);
}
});