@@ -349,7 +349,7 @@ static VALUE _native_new(VALUE klass) {
349349 ddog_prof_ManagedStringStorageNewResult string_storage = ddog_prof_ManagedStringStorage_new ();
350350
351351 if (string_storage .tag == DDOG_PROF_MANAGED_STRING_STORAGE_NEW_RESULT_ERR ) {
352- rb_raise (rb_eRuntimeError , "Failed to initialize string storage: %" PRIsVALUE , get_error_details_and_drop (& string_storage .err ));
352+ rb_raise (datadog_profiling_internal_error_class , "Failed to initialize string storage: %" PRIsVALUE , get_error_details_and_drop (& string_storage .err ));
353353 }
354354
355355 state -> string_storage = string_storage .ok ;
@@ -383,7 +383,7 @@ static void initialize_profiles(stack_recorder_state *state, ddog_prof_Slice_Val
383383 ddog_prof_Profile_with_string_storage (sample_types , NULL /* period is optional */ , state -> string_storage );
384384
385385 if (slot_one_profile_result .tag == DDOG_PROF_PROFILE_NEW_RESULT_ERR ) {
386- rb_raise (rb_eRuntimeError , "Failed to initialize slot one profile: %" PRIsVALUE , get_error_details_and_drop (& slot_one_profile_result .err ));
386+ rb_raise (datadog_profiling_internal_error_class , "Failed to initialize slot one profile: %" PRIsVALUE , get_error_details_and_drop (& slot_one_profile_result .err ));
387387 }
388388
389389 state -> profile_slot_one = (profile_slot ) { .profile = slot_one_profile_result .ok , .start_timestamp = start_timestamp };
@@ -393,7 +393,7 @@ static void initialize_profiles(stack_recorder_state *state, ddog_prof_Slice_Val
393393
394394 if (slot_two_profile_result .tag == DDOG_PROF_PROFILE_NEW_RESULT_ERR ) {
395395 // Note: No need to take any special care of slot one, it'll get cleaned up by stack_recorder_typed_data_free
396- rb_raise (rb_eRuntimeError , "Failed to initialize slot two profile: %" PRIsVALUE , get_error_details_and_drop (& slot_two_profile_result .err ));
396+ rb_raise (datadog_profiling_internal_error_class , "Failed to initialize slot two profile: %" PRIsVALUE , get_error_details_and_drop (& slot_two_profile_result .err ));
397397 }
398398
399399 state -> profile_slot_two = (profile_slot ) { .profile = slot_two_profile_result .ok , .start_timestamp = start_timestamp };
@@ -591,7 +591,7 @@ static VALUE _native_serialize(DDTRACE_UNUSED VALUE _self, VALUE recorder_instan
591591
592592 ddog_prof_MaybeError result = args .advance_gen_result ;
593593 if (result .tag == DDOG_PROF_OPTION_ERROR_SOME_ERROR ) {
594- rb_raise (rb_eRuntimeError , "Failed to advance string storage gen: %" PRIsVALUE , get_error_details_and_drop (& result .some ));
594+ rb_raise (datadog_profiling_internal_error_class , "Failed to advance string storage gen: %" PRIsVALUE , get_error_details_and_drop (& result .some ));
595595 }
596596
597597 VALUE start = ruby_time_from (args .slot -> start_timestamp );
@@ -824,7 +824,7 @@ static locked_profile_slot sampler_lock_active_profile(stack_recorder_state *sta
824824 }
825825
826826 // We already tried both multiple times, and we did not succeed. This is not expected to happen. Let's stop sampling.
827- rb_raise (rb_eRuntimeError , "Failed to grab either mutex in sampler_lock_active_profile" );
827+ rb_raise (datadog_profiling_error_class , "Failed to grab either mutex in sampler_lock_active_profile" );
828828}
829829
830830static void sampler_unlock_active_profile (locked_profile_slot active_slot ) {
@@ -889,7 +889,7 @@ static VALUE test_slot_mutex_state(VALUE recorder_instance, int slot) {
889889 return Qtrue ;
890890 } else {
891891 ENFORCE_SUCCESS_GVL (error );
892- rb_raise (rb_eRuntimeError , "Failed to raise exception in test_slot_mutex_state; this should never happen" );
892+ rb_raise (datadog_profiling_error_class , "Failed to raise exception in test_slot_mutex_state; this should never happen" );
893893 }
894894}
895895
@@ -941,7 +941,7 @@ static VALUE _native_track_object(DDTRACE_UNUSED VALUE _self, VALUE recorder_ins
941941static void reset_profile_slot (profile_slot * slot , ddog_Timespec start_timestamp ) {
942942 ddog_prof_Profile_Result reset_result = ddog_prof_Profile_reset (& slot -> profile );
943943 if (reset_result .tag == DDOG_PROF_PROFILE_RESULT_ERR ) {
944- rb_raise (rb_eRuntimeError , "Failed to reset profile: %" PRIsVALUE , get_error_details_and_drop (& reset_result .err ));
944+ rb_raise (datadog_profiling_internal_error_class , "Failed to reset profile: %" PRIsVALUE , get_error_details_and_drop (& reset_result .err ));
945945 }
946946 slot -> start_timestamp = start_timestamp ;
947947 slot -> stats = (stats_slot ) {};
@@ -1056,14 +1056,14 @@ static VALUE _native_test_managed_string_storage_produces_valid_profiles(DDTRACE
10561056 ddog_prof_ManagedStringStorageNewResult string_storage = ddog_prof_ManagedStringStorage_new ();
10571057
10581058 if (string_storage .tag == DDOG_PROF_MANAGED_STRING_STORAGE_NEW_RESULT_ERR ) {
1059- rb_raise (rb_eRuntimeError , "Failed to initialize string storage: %" PRIsVALUE , get_error_details_and_drop (& string_storage .err ));
1059+ rb_raise (datadog_profiling_internal_error_class , "Failed to initialize string storage: %" PRIsVALUE , get_error_details_and_drop (& string_storage .err ));
10601060 }
10611061
10621062 ddog_prof_Slice_ValueType sample_types = {.ptr = all_value_types , .len = ALL_VALUE_TYPES_COUNT };
10631063 ddog_prof_Profile_NewResult profile = ddog_prof_Profile_with_string_storage (sample_types , NULL , string_storage .ok );
10641064
10651065 if (profile .tag == DDOG_PROF_PROFILE_NEW_RESULT_ERR ) {
1066- rb_raise (rb_eRuntimeError , "Failed to initialize profile: %" PRIsVALUE , get_error_details_and_drop (& profile .err ));
1066+ rb_raise (datadog_profiling_internal_error_class , "Failed to initialize profile: %" PRIsVALUE , get_error_details_and_drop (& profile .err ));
10671067 }
10681068
10691069 ddog_prof_ManagedStringId hello = intern_or_raise (string_storage .ok , DDOG_CHARSLICE_C ("hello" ));
@@ -1105,13 +1105,13 @@ static VALUE _native_test_managed_string_storage_produces_valid_profiles(DDTRACE
11051105 ddog_prof_Profile_SerializeResult serialize_result = ddog_prof_Profile_serialize (& profile .ok , & start_timestamp , & finish_timestamp );
11061106
11071107 if (serialize_result .tag == DDOG_PROF_PROFILE_SERIALIZE_RESULT_ERR ) {
1108- rb_raise (rb_eRuntimeError , "Failed to serialize: %" PRIsVALUE , get_error_details_and_drop (& serialize_result .err ));
1108+ rb_raise (datadog_profiling_internal_error_class , "Failed to serialize: %" PRIsVALUE , get_error_details_and_drop (& serialize_result .err ));
11091109 }
11101110
11111111 ddog_prof_MaybeError advance_gen_result = ddog_prof_ManagedStringStorage_advance_gen (string_storage .ok );
11121112
11131113 if (advance_gen_result .tag == DDOG_PROF_OPTION_ERROR_SOME_ERROR ) {
1114- rb_raise (rb_eRuntimeError , "Failed to advance string storage gen: %" PRIsVALUE , get_error_details_and_drop (& advance_gen_result .some ));
1114+ rb_raise (datadog_profiling_internal_error_class , "Failed to advance string storage gen: %" PRIsVALUE , get_error_details_and_drop (& advance_gen_result .some ));
11151115 }
11161116
11171117 VALUE encoded_pprof_1 = from_ddog_prof_EncodedProfile (serialize_result .ok );
0 commit comments