Skip to content

Commit

Permalink
AVRO-3779: Minor improvements in the error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
  • Loading branch information
martin-g committed Oct 10, 2023
1 parent a822ea3 commit 561ae83
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lang/rust/avro/src/decimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub(crate) fn deserialize_big_decimal(bytes: &Vec<u8>) -> Result<BigDecimal, Err
let mut bytes: &[u8] = bytes.as_slice();
let mut big_decimal_buffer = match decode_len(&mut bytes) {
Ok(size) => vec![0u8; size],
Err(_err) => return Err(Error::BigDecimalLen),
Err(err) => return Err(Error::BigDecimalLen(Box::new(err))),
};

bytes
Expand Down
8 changes: 4 additions & 4 deletions lang/rust/avro/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,13 @@ pub enum Error {
#[error("The decimal precision ({precision}) must be a positive number")]
DecimalPrecisionMuBePositive { precision: usize },

#[error("Unreadable decimal sign")]
#[error("Unreadable big decimal sign")]
BigDecimalSign,

#[error("Unreadable length for decimal inner bytes")]
BigDecimalLen,
#[error("Unreadable length for big decimal inner bytes: {0}")]
BigDecimalLen(#[source] Box<Error>),

#[error("Unreadable decimal scale")]
#[error("Unreadable big decimal scale")]
BigDecimalScale,

#[error("Unexpected `type` {0} variant for `logicalType`")]
Expand Down

0 comments on commit 561ae83

Please sign in to comment.