Skip to content

Commit

Permalink
return error if not valid u16
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Sep 22, 2024
1 parent d8068bc commit 0bc4d36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/katana/runner/macro/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ impl Configuration {
return Err(syn::Error::new(span, "`accounts` set multiple times."));
}

let accounts = parse_int(accounts, span, "accounts")? as u16;
let int = parse_int(accounts, span, "accounts")?;
let accounts = u16::try_from(int)
.map_err(|_| syn::Error::new(span, "`accounts` must be a valid u16."))?;

self.accounts = Some(accounts);

Ok(())
Expand Down

0 comments on commit 0bc4d36

Please sign in to comment.