mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-09-01 09:48:23 +00:00
Some movement of helper code and refactoring of error handling
This commit is contained in:
+7
-1
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user