This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/main by this push:
new 561ae8399 AVRO-3779: Minor improvements in the error handling
561ae8399 is described below
commit 561ae83998bec578184b2389235d52edb0118d54
Author: Martin Tzvetanov Grigorov <[email protected]>
AuthorDate: Tue Oct 10 22:57:16 2023 +0300
AVRO-3779: Minor improvements in the error handling
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
---
lang/rust/avro/src/decimal.rs | 2 +-
lang/rust/avro/src/error.rs | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/lang/rust/avro/src/decimal.rs b/lang/rust/avro/src/decimal.rs
index da5cb35f0..4237d7108 100644
--- a/lang/rust/avro/src/decimal.rs
+++ b/lang/rust/avro/src/decimal.rs
@@ -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
diff --git a/lang/rust/avro/src/error.rs b/lang/rust/avro/src/error.rs
index 1487296a7..7b27ad57b 100644
--- a/lang/rust/avro/src/error.rs
+++ b/lang/rust/avro/src/error.rs
@@ -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`")]