agent: return gRPC Internal error on submission failure

This allows us to distinguish between temporary and permanent failure.

Unless we check the instruction error that occured, we can't know
whether the submission error is a permanent failure and Internal
is therefore the appropriate code to use.

ghstack-source-id: aff1de9516
Pull Request resolved: https://github.com/certusone/wormhole/pull/47
This commit is contained in:
Leo 2020-10-22 12:20:12 +02:00
parent 08156ca438
commit faf9a71cef
1 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ impl Agent for AgentImpl {
Ok(_) => (), Ok(_) => (),
Err(e) => { Err(e) => {
return Err(Status::new( return Err(Status::new(
Code::Unavailable, Code::Internal,
format!("tx sending failed: {}", e), format!("tx sending failed: {}", e),
)); ));
} }
@ -106,7 +106,7 @@ impl Agent for AgentImpl {
signature: s.to_string(), signature: s.to_string(),
})), })),
Err(e) => Err(Status::new( Err(e) => Err(Status::new(
Code::Unavailable, Code::Internal,
format!("tx sending failed: {}", e), format!("tx sending failed: {}", e),
)), )),
} }