Skip to main content

error_response

Function error_response 

Source
pub fn error_response(error: Error, verbatim_db_errors: bool) -> Response<Bytes>
Expand description

Build an error response.

In production mode (PGRST_DEBUG=false or unset), sensitive error details are hidden to prevent information leakage. Build the response for a failed request.

verbatim_db_errors passes a database failure through as PostgreSQL reported it – its SQLSTATE, message, detail and hint – which is what PostgREST does and what a client written against PostgREST branches on. It is off unless compatibility mode is on, because those fields describe the schema rather than the request: a constraint’s name, a column that was not selected, the text of a failing query. Everything else is reported the same either way.