File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ use ddcommon::tag::Tag;
11
11
use ddcommon_ffi:: slice:: { AsBytes , ByteSlice , CharSlice , Slice } ;
12
12
use ddcommon_ffi:: { Error , MaybeError , Timespec } ;
13
13
use std:: borrow:: Cow ;
14
+ use std:: panic:: { AssertUnwindSafe , catch_unwind} ;
14
15
use std:: ptr:: NonNull ;
15
16
use std:: str:: FromStr ;
16
17
@@ -200,11 +201,16 @@ pub unsafe extern "C" fn ddog_prof_Exporter_set_timeout(
200
201
exporter : Option < & mut ProfileExporter > ,
201
202
timeout_ms : u64 ,
202
203
) -> MaybeError {
203
- if let Some ( ptr) = exporter {
204
- ptr. set_timeout ( timeout_ms) ;
205
- MaybeError :: None
206
- } else {
207
- MaybeError :: Some ( Error :: from ( "Invalid argument" ) )
204
+ match catch_unwind ( AssertUnwindSafe ( || {
205
+ if let Some ( ptr) = exporter {
206
+ ptr. set_timeout ( timeout_ms) ;
207
+ MaybeError :: None
208
+ } else {
209
+ MaybeError :: Some ( Error :: from ( "Invalid argument" ) )
210
+ }
211
+ } ) ) {
212
+ Ok ( r) => r,
213
+ Err ( _) => MaybeError :: Some ( Error :: from ( "oops" ) )
208
214
}
209
215
}
210
216
You can’t perform that action at this time.
0 commit comments