Ruby 2.7.7p221 (2022-11-24 revision 168ec2b1e5ad0e4688e963d9de019557c78feed9)
|
Data Structures | |
struct | bug_reporters |
Macros | |
#define | EXIT_SUCCESS 0 |
#define | WIFEXITED(status) 1 |
#define | WEXITSTATUS(status) (status) |
#define | with_warning_string(mesg, enc, fmt) |
#define | MAX_BUG_REPORTERS 0x100 |
#define | REPORT_BUG_BUFSIZ 256 |
#define | bug_report_begin(out, fmt) |
#define | report_bug(file, line, fmt, ctx) |
#define | report_bug_valist(file, line, fmt, ctx, args) |
#define | write_or_abort(fd, str, len) (write((fd), (str), (len)) < 0 ? abort() : (void)0) |
#define | WRITE_CONST(fd, str) write_or_abort((fd),(str),sizeof(str) - 1) |
#define | UNDEF_LEAKED "undef leaked to the Ruby space" |
#define | id_cause ruby_static_id_cause |
#define | id_bt idBt |
#define | id_bt_locations idBt_locations |
#define | id_mesg idMesg |
#define | id_name idName |
#define | frozen_err_receiver name_err_receiver |
#define | name_err_mesg_free RUBY_TYPED_DEFAULT_FREE |
Enumerations | |
enum | { NAME_ERR_MESG__MESG , NAME_ERR_MESG__RECV , NAME_ERR_MESG__NAME , NAME_ERR_MESG_COUNT } |
#define bug_report_begin | ( | out, | |
fmt | |||
) |
#define id_bt_locations idBt_locations |
#define id_cause ruby_static_id_cause |
#define name_err_mesg_free RUBY_TYPED_DEFAULT_FREE |
#define report_bug | ( | file, | |
line, | |||
fmt, | |||
ctx | |||
) |
#define report_bug_valist | ( | file, | |
line, | |||
fmt, | |||
ctx, | |||
args | |||
) |
#define with_warning_string | ( | mesg, | |
enc, | |||
fmt | |||
) |
#define WRITE_CONST | ( | fd, | |
str | |||
) | write_or_abort((fd),(str),sizeof(str) - 1) |
anonymous enum |
FUNC_MINIMIZED | ( | static void | bug_important_messageFILE *out, const char *const msg, size_t len | ) |
Definition at line 2544 of file error.c.
References rb_class_new_instance(), rb_cObject, rb_define_class(), rb_define_singleton_method(), and rb_eException.
NORETURN | ( | static void | dievoid | ) |
NORETURN | ( | static void | raise_loaderrorVALUE path, VALUE mesg | ) |
NORETURN | ( | static void | unexpected_typeVALUE, int, int | ) |
Definition at line 690 of file error.c.
References strlen(), WRITE_CONST, and write_or_abort.
Definition at line 636 of file error.c.
References fmt, GET_EC, NULL, rb_source_location_cstr(), and report_bug.
Referenced by rb_bug_errno(), rb_check_type(), rb_econv_open_opts(), rb_fix2str(), rb_gc_writebarrier(), rb_maygvl_fd_fix_cloexec(), rb_method_type_name(), rb_obj_freeze(), rb_objspace_free(), rb_thread_call_with_gvl(), rb_thread_terminate_all(), rb_threadptr_root_fiber_setup(), rb_tracearg_eval_script(), rb_tracearg_instruction_sequence(), rb_tracearg_object(), rb_tracearg_raised_exception(), rb_tracearg_return_value(), rb_unexpected_type(), rsock_detect_cloexec(), and ruby_node_name().
void rb_bug_for_fatal_signal | ( | ruby_sighandler_t | default_sighandler, |
int | sig, | ||
const void * | ctx, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 651 of file error.c.
References fmt, GET_EC, NULL, rb_source_location_cstr(), report_bug, and sig.
Definition at line 3049 of file error.c.
References FL_ABLE, obj, and rb_check_frozen_internal.
Definition at line 3030 of file error.c.
References obj, and rb_check_frozen_internal.
Definition at line 3043 of file error.c.
References rb_warning().
Definition at line 839 of file error.c.
References Qundef, rb_bug(), RTYPEDDATA_P, T_DATA, TYPE, and UNDEF_LEAKED.
void * rb_check_typeddata | ( | VALUE | obj, |
const rb_data_type_t * | data_type | ||
) |
VALUE rb_ec_backtrace_location_ary | ( | rb_execution_context_t * | ec, |
long | lev, | ||
long | n | ||
) |
void rb_enc_raise | ( | rb_encoding * | enc, |
VALUE | exc, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 2652 of file error.c.
References exc, fmt, rb_enc_vsprintf(), rb_exc_new3, rb_exc_raise(), va_end, and va_start.
void rb_enc_warn | ( | rb_encoding * | enc, |
const char * | fmt, | ||
... | |||
) |
Definition at line 325 of file error.c.
References fmt, NIL_P, ruby_verbose, and with_warning_string.
An equivalent to ensure
clause.
Equivalent to begin .. ensure .. end
.
Calls the function b_proc with data1 as the argument, then calls e_proc with data2 when execution terminated.
Qnil
if otherwise. Definition at line 1115 of file eval.c.
Referenced by rb_gvar_set(), rb_mutex_sleep(), rb_mutex_synchronize(), rb_str_locktmp_ensure(), rsock_init_inetsock(), and rsock_make_hostent().
Definition at line 2976 of file error.c.
References rb_eFrozenError, and rb_raise().
Definition at line 3008 of file error.c.
References CLASS_OF, exc, id_debug_created_info, PRIsVALUE, rb_eFrozenError, rb_exc_new_str(), rb_ivar_set(), and rb_sprintf().
Definition at line 3036 of file error.c.
References rb_warning().
void rb_error_write | ( | VALUE | errinfo, |
VALUE | emesg, | ||
VALUE | errat, | ||
VALUE | str, | ||
VALUE | highlight, | ||
VALUE | reverse | ||
) |
Definition at line 300 of file eval_error.c.
References CLASS_OF, NIL_P, Qnil, Qundef, rb_stderr_tty_p(), and rb_strlen_lit.
Referenced by rb_ec_error_print().
Raises a fatal error in the current thread.
Same as rb_exc_raise() but raises a fatal error, which Ruby codes cannot rescue.
Definition at line 684 of file eval.c.
References NIL_P.
Definition at line 961 of file error.c.
References len, ptr, rb_class_new_instance(), and rb_str_new.
Referenced by rb_exc_new_cstr(), and rb_interrupt().
Definition at line 968 of file error.c.
References rb_exc_new(), and strlen().
Definition at line 974 of file error.c.
References rb_class_new_instance(), str, and StringValue().
Referenced by rb_error_frozen_object(), and rb_keyword_error_new().
Raises an exception in the current thread.
[in] | mesg | an Exception class or an Exception object. |
always | raises an instance of the given exception class or the given Exception object. |
Definition at line 668 of file eval.c.
References NIL_P.
Referenced by rb_enc_raise(), rb_exit(), rb_f_abort(), rb_interrupt(), rb_mod_syserr_fail(), rb_mod_syserr_fail_str(), rb_name_error(), rb_name_error_str(), rb_sys_fail(), rb_sys_fail_str(), rb_syserr_fail(), rb_syserr_fail_str(), rb_throw_obj(), rb_vm_jump_tag_but_local_jump(), and rb_vraise().
MJIT_FUNC_EXPORTED VALUE rb_exc_set_backtrace | ( | VALUE | exc, |
VALUE | bt | ||
) |
Definition at line 2722 of file error.c.
References fprintf(), rb_print_backtrace(), ruby_thread_has_gvl_p(), and stderr.
Definition at line 2982 of file error.c.
References exc, fmt, rb_eFrozenError, rb_exc_new3, rb_ivar_set(), rb_vsprintf(), va_end, and va_start.
Referenced by rb_class_modify_check(), and rb_thread_local_aset().
Definition at line 1231 of file error.c.
Referenced by rb_ec_error_print().
Definition at line 1053 of file error.c.
References exc, and rb_check_funcall().
Referenced by rb_ec_error_print().
Raises an Interrupt
exception.
Definition at line 697 of file eval.c.
References rb_eInterrupt, rb_exc_new(), and rb_exc_raise().
Referenced by rb_signal_exec().
Definition at line 1867 of file error.c.
References PRIsVALUE, rb_eArgError, rb_raise(), rb_str_new2, and str.
Definition at line 3325 of file iseq.c.
References rb_iseq_local_variables().
Continues the exception caught by rb_protect() and rb_eval_string_protect().
This function never return to the caller.
[in] | the | value of *state which the protect function has set to the their last parameter. |
Definition at line 884 of file eval.c.
References EC_JUMP_TAG, GET_EC, TAG_FATAL, unknown_longjmp_status, and UNLIKELY.
Referenced by ossl_buf2str(), and ossl_membio2str().
Definition at line 1909 of file error.c.
References exc, id_bt, id_mesg, Qnil, rb_eKeyError, rb_ivar_set(), and rb_obj_alloc().
Definition at line 2967 of file error.c.
References err, path, rb_str_append(), rb_str_buf_new_cstr, and rb_str_cat2.
Definition at line 2690 of file error.c.
References fmt, rb_enc_vsprintf(), rb_locale_encoding(), va_end, and va_start.
Referenced by dln_load(), and rb_f_require_relative().
Definition at line 2702 of file error.c.
References fmt, rb_enc_vsprintf(), rb_locale_encoding(), va_end, and va_start.
Make an Exception
object from the list of arguments in a manner similar to Kernel#raise
.
[in] | argc | the number of arguments |
[in] | argv | a pointer to the array of arguments. |
The first form of this function takes a String
argument. Then it returns a RuntimeError
whose error message is the given value.
The second from of this function takes an Exception
object. Then it just returns the given value.
The last form takes an exception class, an optional error message and an optional array of backtrace. Then it passes the optional arguments to #exception
method of the exception class.
Qnil
if argc
is 0. Definition at line 2851 of file error.c.
References exc, mod, rb_exc_raise(), rb_extend_object(), and rb_syserr_new().
Definition at line 2859 of file error.c.
References exc, mod, rb_exc_raise(), rb_extend_object(), and rb_syserr_new_str().
Definition at line 1594 of file error.c.
References exc, rb_eNameError, and rb_obj_alloc().
Referenced by rb_make_no_method_exception().
Definition at line 1515 of file error.c.
References argv, exc, fmt, ID2SYM, rb_class_new_instance(), rb_eNameError, rb_exc_raise(), rb_vsprintf(), va_end, and va_start.
Referenced by rb_gvar_readonly_setter(), and rb_id_attrset().
Definition at line 1530 of file error.c.
References argv, exc, fmt, rb_class_new_instance(), rb_eNameError, rb_exc_raise(), rb_vsprintf(), str, va_end, and va_start.
Referenced by rb_f_untrace_var().
Definition at line 1675 of file error.c.
References exc, rb_eNoMethodError, and rb_obj_alloc().
Referenced by rb_make_no_method_exception().
Definition at line 2714 of file error.c.
References PRIsVALUE, rb_eNotImpError, rb_frame_this_func(), rb_id2str, and rb_raise().
Referenced by flock(), and rb_f_notimplement().
Protects a function call from potential global escapes from the function.
Such global escapes include exceptions, Kernel#throw
, break
in an iterator, for example. It first calls the function func with arg as the argument. If no exception occurred during func, it returns the result of func and *state is zero. Otherwise, it returns Qnil and sets *state to nonzero. If state is NULL, it is not set in both cases.
You have to clear the error info with rb_set_errinfo(Qnil) when ignoring the caught exception.
Definition at line 1072 of file eval.c.
Referenced by goruby_run_node(), ossl_generate_cb_2(), ossl_pem_passwd_cb(), ossl_pkey_new(), ossl_str_new(), ossl_verify_cb_call(), rb_eval_string_protect(), rb_eval_string_wrap(), and rb_execarg_parent_start().
Definition at line 2671 of file error.c.
References exc, fmt, rb_vraise(), va_end, and va_start.
Referenced by generic_to_value(), Init_openssl(), int_to_ffi_type(), ole_variant2val(), onigenc_single_byte_code_to_mbc(), rb_add_method_cfunc(), rb_alias(), rb_alloc_tmp_buffer(), rb_ary_resize(), rb_ary_store(), rb_autoload(), rb_autoload_str(), rb_big_mul_karatsuba(), rb_big_mul_toom3(), rb_bool_expected(), rb_check_id(), rb_check_inheritable(), rb_class_inherited_p(), rb_class_superclass(), rb_const_set(), rb_current_receiver(), rb_declare_transcoder(), rb_define_class(), rb_define_class_id_under(), rb_define_module(), rb_define_module_id_under(), rb_econv_append(), rb_enc_associate_index(), rb_enc_check(), rb_enc_codelen(), rb_enc_codepoint_len(), rb_enc_set_default_external(), rb_enc_uint_chr(), rb_eof_error(), rb_error_frozen(), rb_execarg_addopt(), rb_fix2str(), rb_Hash(), rb_insecure_operation(), rb_int_powm(), rb_invalid_str(), rb_io_check_byte_readable(), rb_io_check_char_readable(), rb_io_check_initialized(), rb_io_check_writable(), rb_io_modestr_fmode(), rb_iseq_ibf_dump(), rb_lambda_call(), rb_must_asciicompat(), rb_notimplement(), rb_num2fix(), rb_num2long(), rb_num_get_rounding_option(), rb_num_zerodiv(), rb_obj_encoding(), rb_obj_init_copy(), rb_path_to_class(), rb_range_beg_len(), rb_secure(), rb_set_errinfo(), rb_set_safe_level(), rb_str_cat(), rb_str_cat_conv_enc_opts(), rb_str_concat(), rb_str_ellipsize(), rb_str_modify_expand(), rb_str_plus(), rb_str_resize(), rb_str_setter(), rb_str_unlocktmp(), rb_struct_init_copy(), rb_struct_members(), rb_sym_proc_call(), rb_thread_stop(), rb_thread_wakeup(), rb_time_new(), rb_tracearg_eval_script(), rb_tracearg_instruction_sequence(), rb_tracearg_object(), rb_tracearg_raised_exception(), rb_tracearg_return_value(), rb_undef(), rb_uv_to_utf8(), rb_vm_cbase(), rb_vm_ifunc_new(), rb_vm_make_binding(), rb_warning_category_from_name(), rb_yield_splat(), rb_yield_splat_kw(), rsock_io_socket_addrinfo(), RUBY_ALIAS_FUNCTION(), ruby_malloc_size_overflow(), value_to_generic(), and VpAlloc().
Definition at line 712 of file error.c.
References fmt, NULL, report_bug_valist, and RSTRING_PTR.
An equivalent of rescue
clause.
Equivalent to begin .. rescue .. end
.
It is same as
Definition at line 1047 of file eval.c.
References rb_eStandardError, and rb_rescue2().
VALUE rb_rescue2 | ( | VALUE(*)(VALUE) | b_proc, |
VALUE | data1, | ||
VALUE(*)(VALUE, VALUE) | r_proc, | ||
VALUE | data2, | ||
... | |||
) |
An equivalent of rescue
clause.
Equivalent to begin .. rescue err_type .. end
[in] | b_proc | a function which potentially raises an exception. |
[in] | data1 | the argument of b_proc |
[in] | r_proc | a function which rescues an exception in b_proc. |
[in] | data2 | the first argument of r_proc |
[in] | ... | 1 or more exception classes. Must be terminated by (VALUE)0. |
First it calls the function b_proc, with data1 as the argument. When b_proc raises an exception, it calls r_proc with data2 and the exception object if the exception is a kind of one of the given exception classes.
Definition at line 962 of file eval.c.
References rb_vrescue2(), va_end, and va_start.
Referenced by rb_rescue().
Sets the current exception ($!
) to the given value.
[in] | err | an Exception object or Qnil . |
TypeError | if err is neither an exception nor nil . |
rb_raise()
when you want to raise. Definition at line 1896 of file eval.c.
References err, GET_EC, NIL_P, rb_eException, rb_eTypeError, rb_obj_is_kind_of(), and rb_raise().
Definition at line 7689 of file io.c.
References ENCODING_GET, len, n, ptr, rb_enc_ascget(), rb_enc_from_index(), rb_enc_mbminlen, RSTRING_LEN, RSTRING_PTR, and str.
VALUE rb_syntax_error_append | ( | VALUE | exc, |
VALUE | file, | ||
int | line, | ||
int | column, | ||
rb_encoding * | enc, | ||
const char * | fmt, | ||
va_list | args | ||
) |
Definition at line 104 of file error.c.
References exc, NIL_P, NULL, rb_enc_str_new(), and RSTRING_PTR.
void rb_sys_enc_warning | ( | rb_encoding * | enc, |
const char * | fmt, | ||
... | |||
) |
Definition at line 2945 of file error.c.
References errno, fmt, RTEST, ruby_verbose, and with_warning_string.
Definition at line 2795 of file error.c.
References rb_exc_raise().
Referenced by rb_timespec_now(), rsock_bsock_send(), rsock_make_fd_nonblock(), rsock_sock_listen(), and ruby_getcwd().
Definition at line 2921 of file error.c.
References errno, fmt, RTEST, ruby_verbose, and with_warning_string.
void rb_syserr_enc_warning | ( | int | err, |
rb_encoding * | enc, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 2957 of file error.c.
References fmt, RTEST, ruby_verbose, and with_warning_string.
Definition at line 2783 of file error.c.
References rb_exc_raise(), and rb_syserr_new().
Referenced by rb_fdopen(), rsock_init_sock(), rsock_raise_socket_error(), rsock_syserr_fail_path(), and ruby_getcwd().
Definition at line 2789 of file error.c.
References rb_exc_raise(), and rb_syserr_new_str().
Referenced by rsock_syserr_fail_host_port(), rsock_syserr_fail_path(), and rsock_syserr_fail_raddrinfo().
Definition at line 2769 of file error.c.
References arg, n, Qnil, rb_str_new2, and rb_syserr_new_str().
Referenced by rb_mod_syserr_fail(), and rb_syserr_fail().
Definition at line 2777 of file error.c.
References arg, and rb_class_new_instance().
Referenced by rb_mod_syserr_fail_str(), rb_syserr_fail_str(), and rb_syserr_new().
int rb_typeddata_inherited_p | ( | const rb_data_type_t * | child, |
const rb_data_type_t * | parent | ||
) |
Definition at line 864 of file error.c.
References rb_data_type_struct::parent.
Referenced by rb_typeddata_is_kind_of().
int rb_typeddata_is_instance_of | ( | VALUE | obj, |
const rb_data_type_t * | data_type | ||
) |
int rb_typeddata_is_kind_of | ( | VALUE | obj, |
const rb_data_type_t * | data_type | ||
) |
Definition at line 874 of file error.c.
References obj, RB_TYPE_P, rb_typeddata_inherited_p(), RTYPEDDATA_P, RTYPEDDATA_TYPE, and T_DATA.
Referenced by rb_backtrace_p(), rb_obj_is_fiber(), rb_obj_is_method(), rb_obj_is_mutex(), rb_obj_is_proc(), and rb_obj_is_thread().
Definition at line 854 of file error.c.
References Qundef, rb_bug(), and UNDEF_LEAKED.
Definition at line 2665 of file error.c.
References exc, fmt, rb_exc_new3, rb_exc_raise(), and rb_vsprintf().
Referenced by rb_raise().
Definition at line 315 of file error.c.
References fmt, NIL_P, ruby_verbose, and with_warning_string.
Referenced by Init_continuation(), ossl_clear_error(), rb_check_safe_obj(), rb_const_warn_if_deprecated(), rb_define_const(), rb_eval_cmd(), rb_fdopen(), rb_find_file_ext_safe(), rb_find_file_safe(), rb_insecure_operation(), rb_require_safe(), rb_safe_level(), rb_secure(), rb_secure_update(), rb_set_safe_level(), rb_set_safe_level_force(), rb_time_succ(), rb_undef(), and ruby_safe_level_2_warning().
Definition at line 366 of file error.c.
References NIL_P, RB_WARN_CATEGORY_DEPRECATED, rb_warning_category_enabled_p(), ruby_verbose, and va_start.
Definition at line 336 of file error.c.
References fmt, RTEST, ruby_verbose, and with_warning_string.
Referenced by rb_check_trusted(), and rb_error_untrusted().
MJIT_FUNC_EXPORTED bool rb_warning_category_enabled_p | ( | rb_warning_category_t | category | ) |
Definition at line 166 of file error.c.
Referenced by rb_const_warn_if_deprecated(), and rb_warn_deprecated().
rb_warning_category_t rb_warning_category_from_name | ( | VALUE | category | ) |
Definition at line 142 of file error.c.
References Check_Type, ID2SYM, PRIsVALUE, rb_eArgError, rb_intern, rb_raise(), RB_WARN_CATEGORY_DEPRECATED, RB_WARN_CATEGORY_EXPERIMENTAL, RB_WARN_CATEGORY_NONE, and T_SYMBOL.
Definition at line 346 of file error.c.
References fmt, and with_warning_string.
VALUE rb_eArgError |
Definition at line 925 of file error.c.
Referenced by rb_invalid_str(), and rb_warning_category_from_name().
VALUE rb_eException |
Definition at line 916 of file error.c.
Referenced by Init_Exception().
VALUE rb_eFrozenError |
Definition at line 923 of file error.c.
Referenced by rb_error_frozen(), rb_error_frozen_object(), and rb_frozen_error_raise().
VALUE rb_eKeyError |
Definition at line 927 of file error.c.
Referenced by rb_key_err_new().
VALUE rb_eNameError |
Definition at line 929 of file error.c.
Referenced by rb_name_err_new(), rb_name_error(), and rb_name_error_str().
VALUE rb_eNoMethodError |
Definition at line 932 of file error.c.
Referenced by rb_nomethod_err_new().
VALUE rb_eNotImpError |
Definition at line 934 of file error.c.
Referenced by rb_notimplement().
Definition at line 43 of file version.c.
Referenced by rb_assert_failure().