Improve database error handling

#7 · closed · 0 comments

View on GitHub ↗

julienbrg

Today a misconfigured `DATABASE_URL` goes unnoticed: the server starts, `tools/list` works, but every tool call fails with a raw node-postgres error that is never logged, and an idle-connection drop can crash the process. Scope: - check the database at startup and exit 1 with a redacted reason on failure - wrap tool handlers: log full details server-side, return safe translated `isError` results (auth, unreachable, bad date, constraint, timeout, otherwise a ref id) - harden the pool: `'error'` listener, connect and statement timeouts - log one line per tool call and rate-limited 401s - local `GET /health` endpoint - tests for all of the above, no real database - docs: CONNECTOR.md troubleshooting, README Operations Done when a bad `.env` shows as `errored` in `pm2 ls` with a clear log line, and tool failures come back as clear `isError` results.

Comments