Skip to content

Commit

Permalink
chore(ampd): improve Stellar client logging on transaction query fail…
Browse files Browse the repository at this point in the history
…ure (#653)
  • Loading branch information
haiyizxx authored Oct 7, 2024
1 parent b635adb commit 0d997fc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ampd/src/stellar/http_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use stellar_rs::horizon_client::HorizonClient;
use stellar_rs::transactions::prelude::{SingleTransactionRequest, TransactionResponse};
use stellar_xdr::curr::{ContractEvent, Limits, ReadXdr, ScAddress, TransactionMeta, VecM};
use thiserror::Error;
use tracing::warn;

#[derive(Error, Debug)]
pub enum Error {
Expand Down Expand Up @@ -101,7 +102,10 @@ impl Client {
.map(|tx_response| tx_response.map(TxResponse::from))
.filter_map(|tx_response| match tx_response {
Ok(tx_response) => Some((tx_response.tx_hash(), tx_response)),
Err(_) => None,
Err(err) => {
warn!(err, "failed to get transaction response");
None
}
})
.collect::<HashMap<_, _>>())
}
Expand All @@ -116,6 +120,9 @@ impl Client {
.get_single_transaction(&tx_hash)
.await
.map(|tx_response| Some(tx_response.into()))
.unwrap_or_default())
.unwrap_or_else(|err| {
warn!(err, "failed to get transaction response");
None
}))
}
}

0 comments on commit 0d997fc

Please sign in to comment.