We have some unwraps/expects in the initialization code. We should replace them with static error handling, wrapping them with eyre in non-library code.
Some examples:
|
let config_yaml = std::fs::read_to_string(&config_path).expect("Failed to read config.yaml"); |
|
let genesis_config: GenesisConfig = |
|
serde_yaml_ng::from_str(&config_yaml).expect("Failed to parse config.yaml"); |
The crate eyre, which we are using, has traits for wrapping errors that includes adding more information, like this example shows:
use eyre::{WrapErr, Result};
fn main() -> Result<()> {
...
it.detach().wrap_err("Failed to detach the important thing")?;
let content = std::fs::read(path)
.wrap_err_with(|| format!("Failed to read instrs from {}", path))?;
...
}
We want to replace any panics in code with either eyre dynamic errors (for our main entrypoint and standalone binary), and thiserror enum messages for other crates. This issue is specifically for the main entrypoint (bin/ethlambda/).
We have some unwraps/expects in the initialization code. We should replace them with static error handling, wrapping them with
eyrein non-library code.Some examples:
ethlambda/bin/ethlambda/src/main.rs
Lines 136 to 138 in 533f785
The crate
eyre, which we are using, has traits for wrapping errors that includes adding more information, like this example shows:We want to replace any panics in code with either
eyredynamic errors (for our main entrypoint and standalone binary), andthiserrorenum messages for other crates. This issue is specifically for the main entrypoint (bin/ethlambda/).