Skip to content

Commit

Permalink
properly report fee estimation epsilon parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
sistemd committed Feb 18, 2025
1 parent 39a1999 commit 2ca4ff0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/pathfinder/src/bin/pathfinder/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,14 @@ fn parse_state_tries(s: &str) -> Result<StateTries, String> {
fn parse_fee_estimation_epsilon(s: &str) -> Result<Percentage, String> {
let value: u8 = s
.parse()
.map_err(|_| "Expected a number between 0 and 100".to_string())?;
.map_err(|_| "Expected a number (u8)".to_string())
.and_then(|value| {
if value > 100 {
Err("Expected a number between 0 and 100".to_string())
} else {
Ok(value)
}
})?;

Ok(Percentage::new(value))
}
Expand Down

0 comments on commit 2ca4ff0

Please sign in to comment.