/analyze endpoint swallows errors — no logging, generic error message
Description
The /analyze REST endpoint catches all exceptions but doesn't log them. The catch block at src/transports/http.ts:48-52 returns a generic {"error": "<message>"} response with no console.error, making it impossible to diagnose failures from server logs (e.g. Cloud Run, Docker).
Current behavior
} catch (error) {
const message = error instanceof Error ? error.message : "Unknown error";
res.writeHead(500, { "Content-Type": "application/json" });
res.end(JSON.stringify({ error: message }));
}
- No stdout/stderr output on error
- Cloud Run logs show only
POST 500 with no traceback
- Root cause is invisible without modifying the code
Proposed fix
Add console.error before the response:
} catch (error) {
console.error("[/analyze] Error processing PDF:", error);
const message = error instanceof Error ? error.message : "Unknown error";
res.writeHead(500, { "Content-Type": "application/json" });
res.end(JSON.stringify({ error: message }));
}
Impact
One-line change. No behavior change for API consumers — same response format. Server operators can now see the full error + stack trace in logs.
/analyze endpoint swallows errors — no logging, generic error message
Description
The
/analyzeREST endpoint catches all exceptions but doesn't log them. The catch block atsrc/transports/http.ts:48-52returns a generic{"error": "<message>"}response with noconsole.error, making it impossible to diagnose failures from server logs (e.g. Cloud Run, Docker).Current behavior
POST 500with no tracebackProposed fix
Add
console.errorbefore the response:Impact
One-line change. No behavior change for API consumers — same response format. Server operators can now see the full error + stack trace in logs.