Skip to content

Commit

Permalink
fixup! feat(advance-runner): log tainted session reason
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelstanley committed Aug 22, 2024
1 parent e1758ed commit 9af7bf9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions offchain/advance-runner/src/server_manager/facade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,21 +199,22 @@ impl ServerManagerFacade {
}
});

// Capture advance-state error
// Capture server-manager error for advance-state request
// to try to get the reason for a possible tainted session error.
if response.is_err() {
let sm_error = response.unwrap_err();
// The server-manager does not inform the reason for a tainted session.
match sm_error {
ServerManagerError::MethodCallError {
method: _,
request_id: _,
source,
} => {
// Original error message to be reported by default.
let mut message = source.message().to_string();
// The server-manager signals with Code::Dataloss when the session has been previously tainted.
// The server-manager signals with code Dataloss when the session has been previously tainted.
if source.code() == tonic::Code::DataLoss {
// Trying to recover it from the session's status.
// If not available, we inform the original status error message.
// Trying to recover the tainted session reason from the session's status.
// If not available, we log the original error message.
let status_response = grpc_call!(
self,
get_session_status,
Expand Down

0 comments on commit 9af7bf9

Please sign in to comment.