macro_rules! error_response {
($status:expr, $msg:expr) => { ... };
}Expand description
Return an HTTP error response for use in handler error arms.
Produces a bare HttpResponse value (not Result) suitable for use in
.map_err(|e| ferro::error_response!(500, e.to_string())) and
.ok_or_else(|| ferro::error_response!(404, "not found")).
§Example
ⓘ
Entity::find_by_id(id).one(db).await
.map_err(|e| ferro::error_response!(500, e.to_string()))?
.ok_or_else(|| ferro::error_response!(404, "Not found"))?;