Skip to content

Commit

Permalink
sdk: silently fail if ws connection can't be made
Browse files Browse the repository at this point in the history
  • Loading branch information
bmwill committed Jun 26, 2024
1 parent 4587701 commit ddbfdca
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions crates/sui-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl SuiClientBuilder {
builder = builder.ping_interval(duration)
}

Some(builder.build(url).await?)
builder.build(url).await.ok()
} else {
None
};
Expand Down Expand Up @@ -359,8 +359,10 @@ impl SuiClientBuilder {
let rpc_methods = Self::parse_methods(&rpc_spec)?;

let subscriptions = if let Some(ws) = ws {
let rpc_spec: Value = ws.request("rpc.discover", rpc_params![]).await?;
Self::parse_methods(&rpc_spec)?
match ws.request("rpc.discover", rpc_params![]).await {
Ok(rpc_spec) => Self::parse_methods(&rpc_spec)?,
Err(_) => Vec::new(),
}
} else {
Vec::new()
};
Expand Down

0 comments on commit ddbfdca

Please sign in to comment.