@@ -135,14 +135,16 @@ pub fn event_from_error(err: &failure::Error) -> Event<'static> {
135
135
}
136
136
137
137
/// Helper function to create an event from a `failure::Fail`.
138
- pub fn event_from_fail < F > ( fail : & F ) -> Event < ' static >
139
- where
140
- F : Fail + Sized ,
141
- {
138
+ pub fn event_from_fail < F : Fail > ( fail : & F ) -> Event < ' static > {
139
+ let mut exceptions = vec ! [ single_fail_to_exception( fail, fail. backtrace( ) ) ] ;
140
+ let mut node = fail as & Fail ;
141
+ while let Some ( cause) = Fail :: cause ( node) {
142
+ exceptions. push ( single_fail_to_exception ( cause, cause. backtrace ( ) ) ) ;
143
+ node = cause;
144
+ }
145
+
142
146
Event {
143
- exceptions : failure:: Fail :: causes ( fail)
144
- . map ( |cause| single_fail_to_exception ( cause, cause. backtrace ( ) ) )
145
- . collect ( ) ,
147
+ exceptions : exceptions,
146
148
level : Level :: Error ,
147
149
..Default :: default ( )
148
150
}
@@ -154,10 +156,7 @@ pub fn capture_error(err: &Error) -> Uuid {
154
156
}
155
157
156
158
/// Captures a `failure::Fail`.
157
- pub fn capture_fail < F > ( fail : & F ) -> Uuid
158
- where
159
- F : Fail + Sized ,
160
- {
159
+ pub fn capture_fail < F : Fail > ( fail : & F ) -> Uuid {
161
160
with_client_and_scope ( |client, scope| client. capture_event ( event_from_fail ( fail) , Some ( scope) ) )
162
161
}
163
162
@@ -207,10 +206,7 @@ pub fn tap_error<T>(rv: Result<T, Error>) -> Result<T, Error> {
207
206
/// # Ok(()) }
208
207
/// # fn main() { test().unwrap() }
209
208
/// ```
210
- pub fn tap_fail < T , F > ( rv : Result < T , F > ) -> Result < T , F >
211
- where
212
- F : Fail + Sized ,
213
- {
209
+ pub fn tap_fail < T , F : Fail > ( rv : Result < T , F > ) -> Result < T , F > {
214
210
match rv {
215
211
Ok ( value) => Ok ( value) ,
216
212
Err ( error) => {
0 commit comments