Skip to content

Commit

Permalink
improve error handle on try_stream!
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmovses committed Aug 20, 2024
1 parent d4c8c76 commit 98995e2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions protocol-units/bridge/chains/movement/src/event_monitoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ impl Stream for MovementCounterpartyMonitoring<MovementAddress, MovementHash> {
>;

fn poll_next(self: Pin<&mut Self>, cx: &mut std::task::Context) -> Poll<Option<Self::Item>> {
let client = self.client.as_ref().unwrap(); // would be nice if poll_next could return Result
let rest_client = client.rest_client();
let client = if let Some(client) = self.client.as_ref() {
client
} else {
return Poll::Ready(None);
};

let rest_client = client.rest_client();
let stream = try_stream! {
loop {
let struct_tag = format!(
Expand Down

0 comments on commit 98995e2

Please sign in to comment.