Skip to content

Commit

Permalink
return error when network is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
oblique committed Dec 10, 2024
1 parent 8694036 commit d24f09f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion node/src/node/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ where
/// Representation of all the errors that can occur when interacting with the [`NodeBuilder`].
#[derive(Debug, thiserror::Error)]
pub enum NodeBuilderError {
/// Network is not specified
#[error("Network is not specified")]
NetworkNotSpecified,

/// Syncing window is smaller than [`MIN_SYNCING_WINDOW`].
#[error("Syncing window is {0:?} but cannot be smaller than {MIN_SYNCING_WINDOW:?}")]
SyncingWindowTooSmall(Duration),
Expand Down Expand Up @@ -237,7 +241,7 @@ where
}

fn build_config(self) -> Result<NodeConfig<B, S>, NodeBuilderError> {
let network = self.network.expect("todo");
let network = self.network.ok_or(NodeBuilderError::NetworkNotSpecified)?;

let bootnodes = if self.bootnodes.is_empty() {
network.canonical_bootnodes().collect()
Expand Down

0 comments on commit d24f09f

Please sign in to comment.