Fix Error source for ParseDenominationError
What changed, and why it matters
This is a tiny Rust bug fix in how one error type reports its underlying cause. It does not create a security vulnerability and cannot be exploited; it only affects how detailed error messages are produced when parsing Bitcoin amount denominations fails.
No security action required; treat as normal code-quality fix.
Security signals we found
No security signals present in diff or commit message
Evidence from the diff
The commit corrects the std::error::Error::source() implementation for ParseDenominationError. Previously the wrapper error returned None, hiding the inner Unknown/PossiblyConfusing errors from error-chain traversal. Now source() returns the wrapped error. This is a correctness/ergonomics fix with no memory-safety, logic, or trust-boundary implications.
Changed components
units/src/amount/error.rsParseDenominationErrorInspect captured patch +2 / −1
diff --git a/units/src/amount/error.rs b/units/src/amount/error.rs
index 0f9d4c1a..a6e0e385 100644
--- a/units/src/amount/error.rs
+++ b/units/src/amount/error.rs
@@ -385,7 +385,8 @@ impl fmt::Display for ParseDenominationError {
impl std::error::Error for ParseDenominationError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match *self {
- Self::Unknown(_) | Self::PossiblyConfusing(_) => None,
+ Self::Unknown(ref e) => Some(e),
+ Self::PossiblyConfusing(ref e) => Some(e),
}
}
}
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.