Is 502 an appropriate status code for a database error?
No, I don’t think an HTTP 502 Bad Gateway error is appropriate when a database error occurs. HTTP errors say something about the HTTP protocol. This specific error indicates a server is trying to relay the HTTP request, but the upstream server did not respond correctly. Your web application communicating with a database server is … Read more