Skip to main content

service_error_status

Function service_error_status 

Source
pub fn service_error_status(err: &ServiceError) -> StatusCode
Expand description

The status a ServiceError answers with, by variant.

A refusal for named reasons — a protected field, a broken rule, a constraint the database refused — is the caller’s to fix: 422, except a refused query parameter (invalid_query), which is 400 like any malformed request. A plain validation error is 400, a missing record 404, a duplicate or conflict 409, and only what is left is a 500.