From 907f5bb0d8d7743a91ee80836aef074a5cc26853 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 23 May 2019 08:05:39 +0200 Subject: [PATCH] src/api2/admin/datastore/backup/service.rs: improve error logging --- src/api2/admin/datastore/backup/service.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api2/admin/datastore/backup/service.rs b/src/api2/admin/datastore/backup/service.rs index d011415d..fbb333f9 100644 --- a/src/api2/admin/datastore/backup/service.rs +++ b/src/api2/admin/datastore/backup/service.rs @@ -99,11 +99,13 @@ impl hyper::service::Service for BackupService { Err(err) => { if let Some(apierr) = err.downcast_ref::() { let mut resp = Response::new(Body::from(apierr.message.clone())); + resp.extensions_mut().insert(ErrorMessageExtension(apierr.message.clone())); *resp.status_mut() = apierr.code; Self::log_response(worker, method, &path, &resp); Ok(resp) } else { let mut resp = Response::new(Body::from(err.to_string())); + resp.extensions_mut().insert(ErrorMessageExtension(err.to_string())); *resp.status_mut() = StatusCode::BAD_REQUEST; Self::log_response(worker, method, &path, &resp); Ok(resp)