getodk / central-backend

Node.js based backend for ODK Central
https://docs.getodk.org/central-intro/
Apache License 2.0
50 stars 73 forks source link

Return problem for Connection Error: timeout exceeded when trying to connect #658

Open alxndrsn opened 1 year ago

alxndrsn commented 1 year ago

Currently this error does not have explicit handling. Better might be to add explicit handling, and return a Problem.

E.g. 503.1 Could not get database connection from the pool.

It is probably only helpful to add explicit handling for the case of an empty connection pool rather than e.g. a timeout connecting to the postgres server.

alxndrsn commented 1 year ago

These errors should be caught and handled, and a Problem returned to the client. However, it's still useful to monitor them in Sentry, so they should also be reported there.

This should probably be handled around https://github.com/getodk/central-backend/blob/master/lib/util/db.js#L495-L497.

For another error that should be handled similarly, see #657.