From 91019ab7059566e9ae592e871f4147adfefa4dcb Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Tue, 5 Dec 2023 21:58:26 -0300 Subject: [PATCH] cli: gracefully handle errors during state data retrieval In the event of a failure to fetch state data, merely print the error received from holod instead of abruptly terminating the CLI. Example: ``` holo# show state /invalid/path % failed to fetch state data: status: InvalidArgument, message: "Failed to get operational data: invalid YANG data path" [snip] holo# ``` Signed-off-by: Renato Westphal --- holo-cli/src/client/grpc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/holo-cli/src/client/grpc.rs b/holo-cli/src/client/grpc.rs index 006ebd8c..506960eb 100644 --- a/holo-cli/src/client/grpc.rs +++ b/holo-cli/src/client/grpc.rs @@ -178,7 +178,7 @@ impl Client for GrpcClient { encoding: proto::Encoding::from(format) as i32, path: xpath.unwrap_or_default(), }) - .expect("Failed to parse gRPC Get() response") + .map_err(Error::Backend)? .into_inner() .data .unwrap();