rest: log response: avoid unnecessary mut on variable
a match expresses the fallback slightly nicer and needs no mut,
which is always nice to avoid.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit 6b5013edb3
)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
acefa2bb6e
commit
218d7e3ec6
|
@ -152,14 +152,13 @@ fn log_response(
|
||||||
let path = &path_query[..MAX_URI_QUERY_LENGTH.min(path_query.len())];
|
let path = &path_query[..MAX_URI_QUERY_LENGTH.min(path_query.len())];
|
||||||
|
|
||||||
let status = resp.status();
|
let status = resp.status();
|
||||||
|
|
||||||
if !(status.is_success() || status.is_informational()) {
|
if !(status.is_success() || status.is_informational()) {
|
||||||
let reason = status.canonical_reason().unwrap_or("unknown reason");
|
let reason = status.canonical_reason().unwrap_or("unknown reason");
|
||||||
|
|
||||||
let mut message = "request failed";
|
let message = match resp.extensions().get::<ErrorMessageExtension>() {
|
||||||
if let Some(data) = resp.extensions().get::<ErrorMessageExtension>() {
|
Some(data) => &data.0,
|
||||||
message = &data.0;
|
None => "request failed",
|
||||||
}
|
};
|
||||||
|
|
||||||
log::error!(
|
log::error!(
|
||||||
"{} {}: {} {}: [client {}] {}",
|
"{} {}: {} {}: [client {}] {}",
|
||||||
|
|
Loading…
Reference in New Issue