mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 15:25:32 +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);
|
||||
}
|
||||
|
||||
let bigint = BigInt::from_radix_be(sign, ¢s, 100)
|
||||
.expect("BUG digit outside of given radix, check math above");
|
||||
let bigint = BigInt::from_radix_be(sign, ¢s, 100).ok_or_else(|e| {
|
||||
crate::Error::Decode("PgNumeric contained an out-of-range digit".into())
|
||||
})?;
|
||||
|
||||
Ok(BigDecimal::new(bigint, scale))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user