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;
1111use ddcommon_ffi:: slice:: { AsBytes , ByteSlice , CharSlice , Slice } ;
1212use ddcommon_ffi:: { Error , MaybeError , Timespec } ;
1313use std:: borrow:: Cow ;
14+ use std:: panic:: { AssertUnwindSafe , catch_unwind} ;
1415use std:: ptr:: NonNull ;
1516use std:: str:: FromStr ;
1617
@@ -200,11 +201,16 @@ pub unsafe extern "C" fn ddog_prof_Exporter_set_timeout(
200201 exporter : Option < & mut ProfileExporter > ,
201202 timeout_ms : u64 ,
202203) -> 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" ) )
208214 }
209215}
210216
You can’t perform that action at this time.
0 commit comments