Skip to content

Commit

Permalink
[cli] Ignore watch timeout error
Browse files Browse the repository at this point in the history
  • Loading branch information
jolestar committed Sep 20, 2022
1 parent c029704 commit 1741d9b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/starcoin/src/cli_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,14 @@ impl CliState {
}

pub fn watch_txn(&self, txn_hash: HashValue) -> Result<ExecutionOutputView> {
let block = self.client.watch_txn(txn_hash, Some(self.watch_timeout))?;
let block = self
.client
.watch_txn(txn_hash, Some(self.watch_timeout))
.map(Some)
.unwrap_or_else(|e| {
println!("Watch txn {:?} err: {:?}", txn_hash, e);
None
});

let txn_info = {
if let Some(info) = self.client.chain_get_transaction_info(txn_hash)? {
Expand All @@ -178,7 +185,7 @@ impl CliState {
if let Some(info) = self.client.chain_get_transaction_info(txn_hash)? {
info
} else {
bail!("transaction execute success, but get transaction info return none, block: {}", block.header.number);
bail!("transaction execute success, but get transaction info return none, block: {}", block.map(|b|b.header.number.to_string()).unwrap_or("unknown".to_string()));
}
}
};
Expand Down

0 comments on commit 1741d9b

Please sign in to comment.