Skip to content

Commit

Permalink
fix: Correctly reverse the exceptions according to the protocol (sean…
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko authored May 15, 2018
1 parent d2246a4 commit fee83b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/integrations/failure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,17 @@ fn single_fail_to_exception<F: Fail + ?Sized>(f: &F, bt: Option<&failure::Backtr
/// Helper function to create an event from a `failure::Error`.
pub fn event_from_error(err: &failure::Error) -> Event<'static> {
let mut exceptions = vec![];

for (idx, cause) in err.causes().enumerate() {
let bt = match cause.backtrace() {
Some(bt) => Some(bt),
// TODO: not 0, but effectively -1
None if idx == 0 => Some(err.backtrace()),
None => None,
};
exceptions.push(single_fail_to_exception(cause, bt));
}

exceptions.reverse();
Event {
exceptions,
level: Level::Error,
Expand All @@ -146,6 +148,7 @@ pub fn event_from_fail<F: Fail + ?Sized>(fail: &F) -> Event<'static> {
ptr = Some(cause);
}

exceptions.reverse();
Event {
exceptions,
level: Level::Error,
Expand Down

0 comments on commit fee83b4

Please sign in to comment.