Skip to content

Commit

Permalink
qualify errors for "cargo check"
Browse files Browse the repository at this point in the history
  • Loading branch information
YaroShkvorets committed Dec 19, 2023
1 parent c38411f commit 914e86e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions antelope.trxstats/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ fn parse_params(input: String) -> Result<Params, Error> {
for param in input.split('&') {
let (key, value) = param
.split_once('=')
.ok_or_else(|| Error::Unexpected(format!("Invalid parameter format: {}", param)))?;
.ok_or_else(|| substreams::errors::Error::Unexpected(format!("Invalid parameter format: {}", param)))?;
let parsed_value = value
.parse::<u32>()
.map_err(|_| Error::Unexpected(format!("Invalid param value for key '{}'", key)))?;
.map_err(|_| substreams::errors::Error::Unexpected(format!("Invalid param value for key '{}'", key)))?;

match key {
"cpu_elapsed" => result.cpu_elapsed = parsed_value,
"net_elapsed" => result.net_elapsed = parsed_value,
"cpu_usage" => result.cpu_usage = parsed_value,
"net_usage" => result.net_usage = parsed_value,
"action_count" => result.action_count = parsed_value,
_ => return Err(Error::Unexpected(format!("Unknown parameter: '{}'", key))),
_ => return Err(substreams::errors::Error::Unexpected(format!("Unknown parameter: '{}'", key))),
}
}

Expand Down

0 comments on commit 914e86e

Please sign in to comment.