mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-05 16:54:50 +00:00
remove .expect()
in impl TryFrom<PgNumeric> for BigDecimal
This commit is contained in:
parent
979c5cc944
commit
7ffec2fef8
@ -125,8 +125,9 @@ impl TryFrom<PgNumeric> for BigDecimal {
|
|||||||
cents.push((digit % 100) as u8);
|
cents.push((digit % 100) as u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
let bigint = BigInt::from_radix_be(sign, ¢s, 100)
|
let bigint = BigInt::from_radix_be(sign, ¢s, 100).ok_or_else(|e| {
|
||||||
.expect("BUG digit outside of given radix, check math above");
|
crate::Error::Decode("PgNumeric contained an out-of-range digit".into())
|
||||||
|
})?;
|
||||||
|
|
||||||
Ok(BigDecimal::new(bigint, scale))
|
Ok(BigDecimal::new(bigint, scale))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user