Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(builder): improve error handling in URL parsing #504

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions opstack/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ impl OpStackClientBuilder {
self
}

pub fn consensus_rpc<T: IntoUrl>(mut self, consensus_rpc: T) -> Self {
self.consensus_rpc = Some(consensus_rpc.into_url().unwrap());
self
pub fn consensus_rpc<T: IntoUrl>(mut self, consensus_rpc: T) -> Result<Self> {
self.consensus_rpc = Some(consensus_rpc.into_url()?);
Ok(self)
}

pub fn execution_rpc<T: IntoUrl>(mut self, execution_rpc: T) -> Self {
self.execution_rpc = Some(execution_rpc.into_url().unwrap());
self
pub fn execution_rpc<T: IntoUrl>(mut self, execution_rpc: T) -> Result<Self> {
self.execution_rpc = Some(execution_rpc.into_url()?);
Ok(self)
}

pub fn rpc_socket(mut self, socket: SocketAddr) -> Self {
Expand Down