aboutsummaryrefslogtreecommitdiff
path: root/src/garage/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/garage/main.rs')
-rw-r--r--src/garage/main.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/garage/main.rs b/src/garage/main.rs
index 69cd16e7..60a13ac7 100644
--- a/src/garage/main.rs
+++ b/src/garage/main.rs
@@ -22,6 +22,8 @@ use garage_util::error::*;
use garage_rpc::system::*;
use garage_rpc::*;
+use garage_model::helper::error::Error as HelperError;
+
use admin::*;
use cli::*;
@@ -136,5 +138,9 @@ async fn cli_command(opt: Opt) -> Result<(), Error> {
let system_rpc_endpoint = netapp.endpoint::<SystemRpc, ()>(SYSTEM_RPC_PATH.into());
let admin_rpc_endpoint = netapp.endpoint::<AdminRpc, ()>(ADMIN_RPC_PATH.into());
- cli_command_dispatch(opt.cmd, &system_rpc_endpoint, &admin_rpc_endpoint, id).await
+ match cli_command_dispatch(opt.cmd, &system_rpc_endpoint, &admin_rpc_endpoint, id).await {
+ Err(HelperError::Internal(i)) => Err(i),
+ Err(HelperError::BadRequest(b)) => Err(Error::Message(format!("bad request: {}", b))),
+ Ok(x) => Ok(x),
+ }
}