Skip to content

Commit 24b371c

Browse files
committed
Fix ErrorImpl::source to return Some for inner error
Correct the logic to preserve each source level: avoid direct source recursion and unwrap the inner error instead. Signed-off-by: Nicola Bonelli <nicola.bonelli@huawei-partners.com>
1 parent 7e23a0b commit 24b371c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

orion-error/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ enum ErrorImpl {
278278
impl ErrorTrait for ErrorImpl {
279279
fn source(&self) -> Option<&(dyn ErrorTrait + 'static)> {
280280
match self {
281-
Self::Error(err) => err.source(),
282-
Self::Context(_, err) => err.source(),
281+
Self::Error(err) | Self::Context(_, err) => Some(err.as_ref()),
283282
}
284283
}
285284
}

0 commit comments

Comments
 (0)