Skip to main content

error_response

Function error_response 

Source
pub fn error_response(error: ProxyError) -> (StatusCode, Json<ApiResponse<()>>)
Expand description

Turn an error into the response a tenant sees.

Errors that are about the request – validation, not found, conflict, quota – carry a message written for the caller, and it is returned. Everything else is ours: a database error, an I/O error, a TLS library’s complaint. Those are logged in full and answered with a fixed message, because their text is written for an operator and says things about the deployment – table and constraint names, file paths, sometimes the offending value – that a tenant has no business reading.

Every response carries a stable code to match on.