Skip to content

Commit e752606

Browse files
authored
Deserialize errors in the proxy. (#4709) (#4716)
Backport of #4709. ## Motivation Errors in chain info results are currently turned into a list of integers (their serialized bytes). ## Proposal Deserialize and `Display` them instead. ## Test Plan CI ## Release Plan - These changes should be released in a validator hotfix. (Not urgent.) ## Links - PR to main: #4709 - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
1 parent 9995c28 commit e752606

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

linera-service/src/proxy/grpc.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use futures::{future::BoxFuture, FutureExt as _};
1919
use linera_base::identifiers::ChainId;
2020
use linera_core::{
2121
data_types::{CertificatesByHeightRequest, ChainInfo, ChainInfoQuery},
22+
node::NodeError,
2223
notifier::ChannelNotifier,
2324
JoinSetExt as _,
2425
};
@@ -734,9 +735,12 @@ where
734735
chain_info.requested_sent_certificate_hashes
735736
}
736737
Some(api::chain_info_result::Inner::Error(error)) => {
738+
let error =
739+
bincode::deserialize(&error).unwrap_or_else(|err| NodeError::GrpcError {
740+
error: format!("failed to unmarshal error message: {}", err),
741+
});
737742
return Err(Status::internal(format!(
738-
"Chain info query failed: {:?}",
739-
error
743+
"Chain info query failed: {error}"
740744
)));
741745
}
742746
None => {
@@ -777,9 +781,12 @@ where
777781
chain_info.requested_sent_certificate_hashes
778782
}
779783
Some(api::chain_info_result::Inner::Error(error)) => {
784+
let error =
785+
bincode::deserialize(&error).unwrap_or_else(|err| NodeError::GrpcError {
786+
error: format!("failed to unmarshal error message: {}", err),
787+
});
780788
return Err(Status::internal(format!(
781-
"Chain info query failed: {:?}",
782-
error
789+
"Chain info query failed: {error}"
783790
)));
784791
}
785792
None => {

0 commit comments

Comments
 (0)