bn_rs/bignumber/error.rs
1use thiserror::Error;
2use wasm_bindgen::JsValue;
3
4#[derive(Error, Debug)]
5pub enum BigNumberError {
6 #[error(transparent)]
7 Std(#[from] std::num::ParseIntError),
8 #[error(transparent)]
9 PrimitiveUint(#[from] uint::FromStrRadixErr),
10 #[error(transparent)]
11 PrimitiveHash(#[from] rustc_hex::FromHexError),
12}
13
14impl From<BigNumberError> for JsValue {
15 fn from(err: BigNumberError) -> Self {
16 format!("{:?}", err).into()
17 }
18}