diff --git a/dozer-ingestion/oracle/src/connector/mapping.rs b/dozer-ingestion/oracle/src/connector/mapping.rs index e109cbbbfa..f452238f85 100644 --- a/dozer-ingestion/oracle/src/connector/mapping.rs +++ b/dozer-ingestion/oracle/src/connector/mapping.rs @@ -109,11 +109,18 @@ fn map_field(index: usize, field: &FieldDefinition, row: &Row) -> Result Field::Float(OrderedFloat(row.get(index)?)), (FieldType::Decimal, true) => match row.get::<_, Option>(index)? { - Some(decimal) => Field::Decimal(Decimal::from_str(&decimal)?), + Some(decimal) => Field::Decimal( + Decimal::from_str(&decimal) + .map_err(|e| crate::connector::Error::NumberToDecimal(e, decimal))?, + ), None => Field::Null, }, (FieldType::Decimal, false) => { - Field::Decimal(Decimal::from_str(&row.get::<_, String>(index)?)?) + let value = row.get::<_, String>(index)?; + Field::Decimal( + Decimal::from_str(&value) + .map_err(|e| crate::connector::Error::NumberToDecimal(e, value))?, + ) } (FieldType::String, true) => row .get::<_, Option>(index)? diff --git a/dozer-ingestion/oracle/src/connector/mod.rs b/dozer-ingestion/oracle/src/connector/mod.rs index 70ea0b617f..38164c3fd5 100644 --- a/dozer-ingestion/oracle/src/connector/mod.rs +++ b/dozer-ingestion/oracle/src/connector/mod.rs @@ -50,8 +50,8 @@ pub enum Error { }, #[error("column count mismatch: expected {expected}, actual {actual}")] ColumnCountMismatch { expected: usize, actual: usize }, - #[error("cannot convert Oracle number to decimal: {0}")] - NumberToDecimal(#[from] rust_decimal::Error), + #[error("cannot convert Oracle number to decimal: {0}. Value: {1:?}")] + NumberToDecimal(rust_decimal::Error, String), #[error("insert failed to match: {0}")] InsertFailedToMatch(String), #[error("delete failed to match: {0}")] diff --git a/dozer-ingestion/oracle/src/connector/replicate/transaction/map.rs b/dozer-ingestion/oracle/src/connector/replicate/transaction/map.rs index 122ce3b5f9..6b3d27dfd2 100644 --- a/dozer-ingestion/oracle/src/connector/replicate/transaction/map.rs +++ b/dozer-ingestion/oracle/src/connector/replicate/transaction/map.rs @@ -112,7 +112,11 @@ fn map_value( .to_f64() .ok_or_else(|| Error::FloatOverflow(number))?, ))), - (ParsedValue::String(string), FieldType::Decimal, _) => Ok(Field::Decimal(string.parse()?)), + (ParsedValue::String(string), FieldType::Decimal, _) => { + Ok(Field::Decimal(string.parse().map_err(|e| { + crate::connector::Error::NumberToDecimal(e, string) + })?)) + } (ParsedValue::Number(number), FieldType::Decimal, _) => Ok(Field::Decimal(number)), (ParsedValue::Number(number), FieldType::Int, _) => Ok(Field::Int( number diff --git a/dozer-ingestion/oracle/src/connector/replicate/transaction/parse/mod.rs b/dozer-ingestion/oracle/src/connector/replicate/transaction/parse/mod.rs index 1bbb371ab8..e8be03ebd4 100644 --- a/dozer-ingestion/oracle/src/connector/replicate/transaction/parse/mod.rs +++ b/dozer-ingestion/oracle/src/connector/replicate/transaction/parse/mod.rs @@ -130,7 +130,9 @@ impl FromStr for ParsedValue { if s.starts_with('\'') { Ok(ParsedValue::String(s[1..s.len() - 1].to_string())) } else { - Ok(ParsedValue::Number(s.parse()?)) + Ok(ParsedValue::Number(s.parse().map_err(|e| { + crate::connector::Error::NumberToDecimal(e, s.to_string()) + })?)) } } }