Skip to content

Commit

Permalink
cli: gracefully handle errors during state data retrieval
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rwestphal committed Dec 6, 2023
1 parent d6b366b commit 91019ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion holo-cli/src/client/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 91019ab

Please sign in to comment.