Skip to content

Commit

Permalink
improve error message when missing environment flag
Browse files Browse the repository at this point in the history
  • Loading branch information
brady.ouren committed Oct 30, 2024
1 parent a66b793 commit f67e72b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion components/chainhook-cli/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ impl Config {
(false, true, false, _) => Config::testnet_default(),
(false, false, true, _) => Config::mainnet_default(),
(false, false, false, Some(config_path)) => Config::from_file_path(config_path)?,
_ => Err("Invalid combination of arguments".to_string())?,
_ => Err("Must include environment flag (for example --devnet)".to_string())?,
};
Ok(config)
}
Expand Down
2 changes: 1 addition & 1 deletion components/chainhook-cli/src/config/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,5 +178,5 @@ fn it_has_default_config_for_each_network() {
let config = Config::default(false, false, false, &Some(path)).unwrap();
assert_eq!(config.network.bitcoin_network, BitcoinNetwork::Regtest);
assert_eq!(config.network.stacks_network, StacksNetwork::Devnet);
Config::default(true, true, false, &None).expect_err("expected invalid combination error");
Config::default(true, true, false, &None).expect_err("expected missing environment flag error");
}

0 comments on commit f67e72b

Please sign in to comment.