Ruby: Exception handlings

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Enumerations | Functions | Variables
Exception handlings

## 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 }

## Functions
VALUE | rb_iseqw_local_variables (VALUE iseqval)
VALUE | rb_iseqw_new (const rb_iseq_t *)
int | rb_str_end_with_asciichar (VALUE str, int c)
VALUE | rb_ident_hash_new (void)
VALUE | rb_syntax_error_append (VALUE exc, VALUE file, int line, int column, rb_encoding *enc, const char *fmt, va_list args)
rb_warning_category_t | rb_warning_category_from_name (VALUE category)
void | rb_warning_category_update (unsigned int mask, unsigned int bits)
bool | rb_warning_category_enabled_p (rb_warning_category_t category)
void | rb_compile_warn (const char *file, int line, const char *fmt,...)
void | rb_compile_warning (const char *file, int line, const char *fmt,...)
void | rb_category_compile_warn (rb_warning_category_t category, const char *file, int line, const char *fmt,...)
void | rb_warn (const char *fmt,...)
void | rb_category_warn (rb_warning_category_t category, const char *fmt,...)
void | rb_enc_warn (rb_encoding *enc, const char *fmt,...)
void | rb_warning (const char *fmt,...)
void | rb_category_warning (rb_warning_category_t category, const char *fmt,...)
VALUE | rb_warning_string (const char *fmt,...)
void | rb_warn_deprecated (const char *fmt, const char *suggest,...)
void | rb_warn_deprecated_to_remove (const char *fmt, const char *removal,...)
VALUE | rb_ec_backtrace_location_ary (const rb_execution_context_t *ec, long lev, long n, bool skip_internal)
int | rb_bug_reporter_add (void(*func)(FILE *, void *), void *data)
| FUNC_MINIMIZED (static void bug_important_message(FILE *out, const char *const msg, size_t len))
void | rb_bug_without_die (const char *fmt, va_list args)
void | rb_bug (const char *fmt,...)
void | rb_bug_for_fatal_signal (ruby_sighandler_t default_sighandler, int sig, const void *ctx, const char *fmt,...)
void | rb_bug_errno (const char *mesg, int errno_arg)
void | rb_async_bug_errno (const char *mesg, int errno_arg)
void | rb_report_bug_valist (VALUE file, int line, const char *fmt, va_list args)
void | rb_assert_failure (const char *file, int line, const char *name, const char *expr)
const char * | rb_builtin_type_name (int t)
const char * | rb_builtin_class_name (VALUE x)
void | rb_check_type (VALUE x, int t)
void | rb_unexpected_type (VALUE x, int t)
int | rb_typeddata_inherited_p (const rb_data_type_t *child, const rb_data_type_t *parent)
int | rb_typeddata_is_kind_of (VALUE obj, const rb_data_type_t *data_type)
int | rb_typeddata_is_instance_of (VALUE obj, const rb_data_type_t *data_type)
void * | rb_check_typeddata (VALUE obj, const rb_data_type_t *data_type)
VALUE | rb_exc_new (VALUE etype, const char *ptr, long len)
VALUE | rb_exc_new_cstr (VALUE etype, const char *s)
VALUE | rb_exc_new_str (VALUE etype, VALUE str)
void | rb_error_write (VALUE errinfo, VALUE emesg, VALUE errat, VALUE str, VALUE highlight, VALUE reverse)
VALUE | rb_get_message (VALUE exc)
VALUE | rb_get_backtrace (VALUE exc)
VALUE | rb_exc_set_backtrace (VALUE exc, VALUE bt)
void | rb_name_error (ID id, const char *fmt,...)
void | rb_name_error_str (VALUE str, const char *fmt,...)
VALUE | rb_name_err_new (VALUE mesg, VALUE recv, VALUE method)
VALUE | rb_nomethod_err_new (VALUE mesg, VALUE recv, VALUE method, VALUE args, int priv)
void | rb_invalid_str (const char *str, const char *type)
VALUE | rb_key_err_new (VALUE mesg, VALUE recv, VALUE key)
void | Init_Exception (void)
void | rb_enc_raise (rb_encoding *enc, VALUE exc, const char *fmt,...)
void | rb_vraise (VALUE exc, const char *fmt, va_list ap)
void | rb_raise (VALUE exc, const char *fmt,...)
void | rb_loaderror (const char *fmt,...)
void | rb_loaderror_with_path (VALUE path, const char *fmt,...)
void | rb_notimplement (void)
void | rb_fatal (const char *fmt,...)
VALUE | rb_syserr_new (int n, const char *mesg)
VALUE | rb_syserr_new_str (int n, VALUE arg)
void | rb_syserr_fail (int e, const char *mesg)
void | rb_syserr_fail_str (int e, VALUE mesg)
void | rb_sys_fail (const char *mesg)
void | rb_sys_fail_str (VALUE mesg)
void | rb_mod_sys_fail (VALUE mod, const char *mesg)
void | rb_mod_sys_fail_str (VALUE mod, VALUE mesg)
void | rb_mod_syserr_fail (VALUE mod, int e, const char *mesg)
void | rb_mod_syserr_fail_str (VALUE mod, int e, VALUE mesg)
void | rb_sys_warning (const char *fmt,...)
void | rb_sys_enc_warning (rb_encoding *enc, const char *fmt,...)
void | rb_syserr_enc_warning (int err, rb_encoding *enc, const char *fmt,...)
void | rb_load_fail (VALUE path, const char *err)
void | rb_error_frozen (const char *what)
void | rb_frozen_error_raise (VALUE frozen_obj, const char *fmt,...)
void | rb_error_frozen_object (VALUE frozen_obj)
void | rb_check_frozen (VALUE obj)
void | rb_error_untrusted (VALUE obj)
void | rb_check_trusted (VALUE obj)
void | rb_check_copyable (VALUE obj, VALUE orig)
void | Init_syserr (void)
void | rb_exc_raise (VALUE mesg)
| Raises an exception in the current thread. More...
void | rb_exc_fatal (VALUE mesg)
| Raises a fatal error in the current thread. More...
void | rb_interrupt (void)
| Raises an `Interrupt` exception. More...
VALUE | rb_make_exception (int argc, const VALUE *argv)
| Make an `Exception` object from the list of arguments in a manner similar to `Kernel#raise`. More...
void | rb_jump_tag (int tag)
| Continues the exception caught by rb_protect() and rb_eval_string_protect(). More...
VALUE | rb_rescue2 (VALUE(*b_proc)(VALUE), VALUE data1, VALUE(*r_proc)(VALUE, VALUE), VALUE data2,...)
| An equivalent of `rescue` clause. More...
VALUE | rb_rescue (VALUE(*b_proc)(VALUE), VALUE data1, VALUE(*r_proc)(VALUE, VALUE), VALUE data2)
| An equivalent of `rescue` clause. More...
VALUE | rb_protect (VALUE(*proc)(VALUE), VALUE data, int *pstate)
| Protects a function call from potential global escapes from the function. More...
VALUE | rb_ensure (VALUE(*b_proc)(VALUE), VALUE data1, VALUE(*e_proc)(VALUE), VALUE data2)
| An equivalent to `ensure` clause. More...
VALUE | rb_errinfo (void)
| The current exception in the current thread. More...
void | rb_set_errinfo (VALUE err)
| Sets the current exception (`$!`) to the given value. More...

## Variables
long | rb_backtrace_length_limit = -1
VALUE | rb_eEAGAIN
VALUE | rb_eEWOULDBLOCK
VALUE | rb_eEINPROGRESS
const char | ruby_description []
VALUE | rb_eException
VALUE | rb_eSystemExit
VALUE | rb_eInterrupt
VALUE | rb_eSignal
VALUE | rb_eFatal
VALUE | rb_eStandardError
VALUE | rb_eRuntimeError
VALUE | rb_eFrozenError
VALUE | rb_eTypeError
VALUE | rb_eArgError
VALUE | rb_eIndexError
VALUE | rb_eKeyError
VALUE | rb_eRangeError
VALUE | rb_eNameError
VALUE | rb_eEncodingError
VALUE | rb_eEncCompatError
VALUE | rb_eNoMethodError
VALUE | rb_eSecurityError
VALUE | rb_eNotImpError
VALUE | rb_eNoMemError
VALUE | rb_cNameErrorMesg
VALUE | rb_eNoMatchingPatternError
VALUE | rb_eScriptError
VALUE | rb_eSyntaxError
VALUE | rb_eLoadError
VALUE | rb_eSystemCallError
VALUE | rb_mErrno
ID | ruby_static_id_cause

## Detailed Description

## Macro Definition Documentation

## ◆ bug_report_begin

#define bug_report_begin | ( |  | out,
|  |  | fmt
| ) |  |

Value:
do { \
va_list args; \
va_start(args, fmt); \
bug_report_begin_valist(out, fmt, args); \
va_end(args); \
} while (0)
out
string_t out
Definition: enough.c:230

Definition at line 704 of file error.c.

## ◆ EXIT_SUCCESS

#define EXIT_SUCCESS 0

Definition at line 52 of file error.c.

## ◆ frozen_err_receiver

#define frozen_err_receiver name_err_receiver

Definition at line 1646 of file error.c.

## ◆ id_bt

#define id_bt idBt

Definition at line 1086 of file error.c.

## ◆ id_bt_locations

#define id_bt_locations idBt_locations

Definition at line 1087 of file error.c.

## ◆ id_cause

#define id_cause ruby_static_id_cause

Definition at line 1081 of file error.c.

## ◆ id_mesg

#define id_mesg idMesg

Definition at line 1088 of file error.c.

## ◆ id_name

#define id_name idName

Definition at line 1089 of file error.c.

## ◆ MAX_BUG_REPORTERS

#define MAX_BUG_REPORTERS 0x100

Definition at line 577 of file error.c.

## ◆ name_err_mesg_free

#define name_err_mesg_free RUBY_TYPED_DEFAULT_FREE

Definition at line 1831 of file error.c.

## ◆ report_bug

#define report_bug | ( |  | file,
|  |  | line,
|  |  | fmt,
|  |  | ctx
| ) |  |

Value:
do { \
FILE *out = bug_report_file(file, line); \
if (out) { \
bug_report_begin(out, fmt); \
rb_vm_bugreport(ctx); \
bug_report_end(out); \
} \
} while (0) \
__sFILE
Definition: vsnprintf.c:169
file
Definition: gzappend.c:170

Definition at line 725 of file error.c.

## ◆ REPORT_BUG_BUFSIZ

#define REPORT_BUG_BUFSIZ 256

Definition at line 601 of file error.c.

## ◆ report_bug_valist

#define report_bug_valist | ( |  | file,
|  |  | line,
|  |  | fmt,
|  |  | ctx,
|  |  | args
| ) |  |

Value:
do { \
FILE *out = bug_report_file(file, line); \
if (out) { \
bug_report_begin_valist(out, fmt, args); \
rb_vm_bugreport(ctx); \
bug_report_end(out); \
} \
} while (0) \

Definition at line 734 of file error.c.

## ◆ UNDEF_LEAKED

#define UNDEF_LEAKED "undef leaked to the Ruby space"

Definition at line 948 of file error.c.

## ◆ WEXITSTATUS

#define WEXITSTATUS | ( |  | status | ) | (status)

Definition at line 60 of file error.c.

## ◆ WIFEXITED

#define WIFEXITED | ( |  | status | ) | 1

Definition at line 56 of file error.c.

## ◆ with_warning_string

#define with_warning_string | ( |  | mesg,
|  |  | enc,
|  |  | fmt
| ) |  |

Value:
VALUE mesg; \
va_list args; va_start(args, fmt); \
mesg = warning_string(enc, fmt, args); \
va_end(args);
VALUE
unsigned long VALUE
Definition: value.h:38

Definition at line 401 of file error.c.

## ◆ WRITE_CONST

#define WRITE_CONST | ( |  | fd,
|  |  | str
| ) |  | write_or_abort((fd),(str),sizeof(str) - 1)

Definition at line 814 of file error.c.

## ◆ write_or_abort

#define write_or_abort | ( |  | fd,
|  |  | str,
|  |  | len
| ) |  | (write((fd), (str), (len)) < 0 ? abort() : (void)0)

Definition at line 813 of file error.c.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
NAME_ERR_MESG__MESG |
NAME_ERR_MESG__RECV |
NAME_ERR_MESG__NAME |
NAME_ERR_MESG_COUNT |

Definition at line 1817 of file error.c.

## Function Documentation

## ◆ FUNC_MINIMIZED()

FUNC_MINIMIZED | ( | static void | bug_important_messageFILE *out, const char *const msg, size_t len | ) |

## ◆ Init_Exception()

void Init_Exception | ( | void |  | ) |

Definition at line 2768 of file error.c.

References frozen_err_receiver, ID2SYM, id_cause, INT2NUM, Qfalse, Qnil, rb_attr(), rb_cEncoding, rb_class_new_instance(), rb_cNameErrorMesg, rb_cObject, rb_cString, rb_define_alloc_func(), rb_define_class(), rb_define_class_under(), rb_define_method, rb_define_module(), rb_define_singleton_method, rb_eArgError, rb_eEncCompatError, rb_eEncodingError, rb_eException, rb_eFatal, rb_eFrozenError, rb_eIndexError, rb_eInterrupt, rb_eKeyError, rb_eLoadError, rb_eNameError, rb_eNoMatchingPatternError, rb_eNoMemError, rb_eNoMethodError, rb_eNotImpError, rb_eRangeError, rb_eRuntimeError, rb_eScriptError, rb_eSecurityError, rb_eSignal, rb_eStandardError, rb_eSyntaxError, rb_eSystemCallError, rb_eSystemExit, rb_eTypeError, rb_extend_object(), rb_gc_register_mark_object(), rb_hash_aset(), rb_ident_hash_new(), rb_make_internal_id(), rb_marshal_define_compat(), rb_mErrno, rb_obj_freeze(), RB_WARN_CATEGORY_DEPRECATED, RB_WARN_CATEGORY_EXPERIMENTAL, RB_WARN_CATEGORY_NONE, and st_init_numtable.

## ◆ Init_syserr()

void Init_syserr | ( | void |  | ) |

Definition at line 3309 of file error.c.

## ◆ rb_assert_failure()

void rb_assert_failure | ( | const char * | file,
|  | int | line,
|  | const char * | name,
|  | const char * | expr
| ) |  |

Definition at line 845 of file error.c.

References name, NULL, out, rb_vm_bugreport(), and ruby_description.

## ◆ rb_async_bug_errno()

void rb_async_bug_errno | ( | const char * | mesg,
|  | int | errno_arg
| ) |  |

Definition at line 817 of file error.c.

References ruby_description, strlen(), WRITE_CONST, and write_or_abort.

## ◆ rb_bug()

void rb_bug | ( | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 768 of file error.c.

References rb_bug_without_die().

Referenced by Init_Encoding(), rb_ary_set_len(), rb_ast_node_type_change(), rb_bug_errno(), rb_check_type(), rb_ec_stack_overflow(), rb_ec_vm_lock_rec_release(), rb_econv_open_opts(), rb_fix2str(), rb_gc_writebarrier(), rb_insn_operand_intern(), rb_load_with_builtin_functions(), rb_maygvl_fd_fix_cloexec(), rb_method_definition_eq(), rb_method_type_name(), rb_mod_init_copy(), rb_obj_freeze(), rb_objspace_free(), rb_objspace_reachable_objects_from(), rb_postponed_job_register(), rb_postponed_job_register_one(), rb_readwrite_syserr_fail(), rb_replace_generic_ivar(), rb_st_nth_key(), rb_str_set_len(), rb_thread_call_with_gvl(), rb_thread_terminate_all(), rb_threadptr_root_fiber_setup(), rb_threadptr_unlock_all_locking_mutexes(), rb_tracearg_eval_script(), rb_tracearg_instruction_sequence(), rb_tracearg_object(), rb_tracearg_raised_exception(), rb_tracearg_return_value(), rb_unexpected_type(), rb_update_max_fd(), rb_vm_insn_addr2insn(), rb_yield_refine_block(), rsock_s_recvfrom(), rsock_s_recvfrom_nonblock(), ruby_node_name(), and VpDivd().

## ◆ rb_bug_errno()

void rb_bug_errno | ( | const char * | mesg,
|  | int | errno_arg
| ) |  |

Definition at line 796 of file error.c.

References rb_bug(), and strerror().

## ◆ rb_bug_for_fatal_signal()

void rb_bug_for_fatal_signal | ( | ruby_sighandler_t | default_sighandler,
|  | int | sig,
|  | const void * | ctx,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 778 of file error.c.

References NULL, rb_source_location_cstr(), and report_bug.

## ◆ rb_bug_reporter_add()

int rb_bug_reporter_add | ( | void(*)(FILE *, void *) | func,
|  | void * | data
| ) |  |

Definition at line 587 of file error.c.

References MAX_BUG_REPORTERS.

## ◆ rb_bug_without_die()

void rb_bug_without_die | ( | const char * | fmt,
|  | va_list | args
| ) |  |

Definition at line 755 of file error.c.

References NULL, rb_source_location_cstr(), and report_bug_valist.

Referenced by rb_bug().

## ◆ rb_builtin_class_name()

const char * rb_builtin_class_name | ( | VALUE | x | ) |

Definition at line 937 of file error.c.

References rb_obj_classname().

Referenced by rb_hash_set_pair(), and rb_sym2id().

## ◆ rb_builtin_type_name()

const char * rb_builtin_type_name | ( | int | t | ) |

Definition at line 890 of file error.c.

References name, numberof, and t.

## ◆ rb_category_compile_warn()

void rb_category_compile_warn | ( | rb_warning_category_t | category,
|  | const char * | file,
|  | int | line,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 380 of file error.c.

References INT2NUM, NIL_P, NULL, rb_hash_fetch(), ruby_verbose, and str.

## ◆ rb_category_warn()

void rb_category_warn | ( | rb_warning_category_t | category,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 418 of file error.c.

References INT2NUM, NIL_P, rb_hash_fetch(), ruby_verbose, and with_warning_string.

## ◆ rb_category_warning()

void rb_category_warning | ( | rb_warning_category_t | category,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 450 of file error.c.

References INT2NUM, rb_hash_fetch(), RTEST, ruby_verbose, and with_warning_string.

## ◆ rb_check_copyable()

void rb_check_copyable | ( | VALUE | obj,
|  | VALUE | orig
| ) |  |

Definition at line 3301 of file error.c.

References FL_ABLE, and rb_check_frozen_internal.

## ◆ rb_check_frozen()

void rb_check_frozen | ( | VALUE | obj | ) |

Definition at line 3282 of file error.c.

References rb_check_frozen_internal.

## ◆ rb_check_trusted()

void rb_check_trusted | ( | VALUE | obj | ) |

Definition at line 3295 of file error.c.

References rb_warn_deprecated_to_remove().

## ◆ rb_check_type()

void rb_check_type | ( | VALUE | x,
|  | int | t
| ) |  |

Definition at line 972 of file error.c.

References Qundef, rb_bug(), t, T_DATA, TYPE, and UNDEF_LEAKED.

## ◆ rb_check_typeddata()

void * rb_check_typeddata | ( | VALUE | obj,
|  | const rb_data_type_t * | data_type
| ) |  |

Definition at line 1024 of file error.c.

References DATA_PTR, name, NULL, PRIsVALUE, rb_eTypeError, rb_raise(), rb_str_new_cstr, rb_typeddata_inherited_p(), T_DATA, UNREACHABLE_RETURN, and rb_data_type_struct::wrap_struct_name.

Referenced by rb_autoload_str().

## ◆ rb_compile_warn()

void rb_compile_warn | ( | const char * | file,
|  | int | line,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 351 of file error.c.

References NIL_P, NULL, ruby_verbose, and str.

## ◆ rb_compile_warning()

void rb_compile_warning | ( | const char * | file,
|  | int | line,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 366 of file error.c.

References NULL, RTEST, ruby_verbose, and str.

## ◆ rb_ec_backtrace_location_ary()

VALUE rb_ec_backtrace_location_ary | ( | const rb_execution_context_t * | ec,
|  | long | lev,
|  | long | n,
|  | bool | skip_internal
| ) |  |

Definition at line 898 of file vm_backtrace.c.

References NULL.

## ◆ rb_enc_raise()

void rb_enc_raise | ( | rb_encoding * | enc,
|  | VALUE | exc,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 2898 of file error.c.

References rb_enc_vsprintf(), rb_exc_new3, and rb_exc_raise().

## ◆ rb_enc_warn()

void rb_enc_warn | ( | rb_encoding * | enc,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 428 of file error.c.

References NIL_P, ruby_verbose, and with_warning_string.

## ◆ rb_ensure()

VALUE rb_ensure | ( | VALUE(*)(VALUE) | b_proc,
|  | VALUE | data1,
|  | VALUE(*)(VALUE) | e_proc,
|  | VALUE | data2
| ) |  |

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.

Returns
  The return value of b_proc if no exception occurred, or `Qnil` if otherwise.

See also
  rb_rescue
  rb_rescue2
  rb_protect

Definition at line 1148 of file eval.c.

References rb_ensure_entry::data2, rb_ensure_entry::e_proc, EC_EXEC_TAG, EC_JUMP_TAG, EC_POP_TAG, EC_PUSH_TAG, rb_execution_context_struct::ensure_list, rb_ensure_list::entry, rb_execution_context_struct::errinfo, rb_ensure_entry::marker, rb_ensure_list::next, NIL_P, Qnil, T_OBJECT, and TAG_NONE.

Referenced by rb_autoload_load(), rb_hash_assoc(), rb_hash_foreach(), rb_mutex_sleep(), rb_mutex_synchronize(), rb_str_locktmp_ensure(), rb_thread_fd_select(), rb_thread_wait_for_single_fd(), rb_uninterruptible(), rb_w32_file_identical_p(), rsock_init_inetsock(), and rsock_make_hostent().

## ◆ rb_errinfo()

VALUE rb_errinfo | ( | void |  | ) |

The current exception in the current thread.

Same as `$!` in Ruby.

Returns
  the current exception or `Qnil`

Definition at line 1911 of file eval.c.

## ◆ rb_error_frozen()

void rb_error_frozen | ( | const char * | what | ) |

Definition at line 3228 of file error.c.

References rb_eFrozenError, and rb_raise().

## ◆ rb_error_frozen_object()

void rb_error_frozen_object | ( | VALUE | frozen_obj | ) |

Definition at line 3260 of file error.c.

References CLASS_OF, id_debug_created_info, NIL_P, PRIsVALUE, rb_ary_entry(), rb_attr_get(), rb_eFrozenError, rb_exc_new_str(), rb_exc_raise(), rb_exec_recursive(), rb_ivar_set(), rb_sprintf(), and rb_str_catf().

## ◆ rb_error_untrusted()

void rb_error_untrusted | ( | VALUE | obj | ) |

Definition at line 3288 of file error.c.

References rb_warn_deprecated_to_remove().

## ◆ rb_error_write()

void rb_error_write | ( | VALUE | errinfo,
|  | VALUE | emesg,
|  | VALUE | errat,
|  | VALUE | str,
|  | VALUE | highlight,
|  | VALUE | reverse
| ) |  |

Definition at line 314 of file eval_error.c.

References APPEND, CLASS_OF, FALSE, len, NIL_P, Qfalse, Qnil, Qundef, rb_stderr_tty_p(), rb_strlen_lit, str, TRUE, and write_warn2.

Referenced by rb_ec_error_print().

## ◆ rb_exc_fatal()

void rb_exc_fatal | ( | VALUE | mesg | ) |

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 728 of file eval.c.

References FALSE, NIL_P, Qnil, and TAG_FATAL.

Referenced by rb_fatal().

## ◆ rb_exc_new()

VALUE rb_exc_new | ( | VALUE | etype,
|  | const char * | ptr,
|  | long | len
| ) |  |

Definition at line 1094 of file error.c.

References len, ptr, rb_class_new_instance(), and rb_str_new.

Referenced by rb_exc_new_cstr(), and rb_interrupt().

## ◆ rb_exc_new_cstr()

VALUE rb_exc_new_cstr | ( | VALUE | etype,
|  | const char * | s
| ) |  |

Definition at line 1101 of file error.c.

References rb_exc_new(), and strlen().

## ◆ rb_exc_new_str()

VALUE rb_exc_new_str | ( | VALUE | etype,
|  | VALUE | str
| ) |  |

Definition at line 1107 of file error.c.

References rb_class_new_instance(), str, and StringValue.

Referenced by ole_raise(), rb_error_frozen_object(), rb_file_expand_path_internal(), rb_keyword_error_new(), rb_ractor_ensure_shareable(), and rsock_raise_socket_error().

## ◆ rb_exc_raise()

void rb_exc_raise | ( | VALUE | mesg | ) |

Raises an exception in the current thread.

Parameters

  [in] | mesg | an Exception class or an `Exception` object.

Exceptions

  always | raises an instance of the given exception class or the given `Exception` object.

Definition at line 712 of file eval.c.

References FALSE, NIL_P, Qundef, and TAG_RAISE.

Referenced by ole_raise(), ossl_raise(), rb_econv_check_error(), rb_enc_raise(), rb_error_arity(), rb_error_frozen_object(), rb_exit(), rb_f_abort(), rb_file_expand_path_internal(), rb_frozen_error_raise(), rb_interrupt(), rb_mod_sys_fail(), rb_mod_sys_fail_str(), rb_mod_syserr_fail(), rb_mod_syserr_fail_str(), rb_name_error(), rb_name_error_str(), rb_ractor_ensure_shareable(), rb_readwrite_syserr_fail(), rb_sys_fail(), rb_sys_fail_str(), rb_syserr_fail(), rb_syserr_fail_str(), rb_threadptr_execute_interrupts(), rb_throw_obj(), rb_vm_jump_tag_but_local_jump(), rb_vm_localjump_error(), rb_vraise(), and rsock_raise_socket_error().

## ◆ rb_exc_set_backtrace()

VALUE rb_exc_set_backtrace | ( | VALUE | exc,
|  | VALUE | bt
| ) |  |

Definition at line 1446 of file error.c.

## ◆ rb_fatal()

void rb_fatal | ( | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 2968 of file error.c.

References rb_eFatal, rb_exc_fatal(), rb_exc_new3, rb_print_backtrace(), rb_vsprintf(), and ruby_thread_has_gvl_p().

Referenced by dln_load(), rb_w32_asynchronize(), and VpException().

## ◆ rb_frozen_error_raise()

void rb_frozen_error_raise | ( | VALUE | frozen_obj,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 3234 of file error.c.

References rb_eFrozenError, rb_exc_new3, rb_exc_raise(), rb_ivar_set(), and rb_vsprintf().

Referenced by rb_class_modify_check(), and rb_thread_local_aset().

## ◆ rb_get_backtrace()

VALUE rb_get_backtrace | ( | VALUE | exc | ) |

Definition at line 1365 of file error.c.

References CLASS_OF, EXEC_EVENT_HOOK, NIL_P, Qnil, Qundef, rb_eException, rb_funcallv, rb_method_basic_definition_p, RUBY_EVENT_C_CALL, and RUBY_EVENT_C_RETURN.

Referenced by rb_ec_error_print().

## ◆ rb_get_message()

VALUE rb_get_message | ( | VALUE | exc | ) |

Definition at line 1187 of file error.c.

References Qnil, Qundef, rb_check_funcall(), rb_check_string_type(), and T_STRING.

Referenced by rb_ec_error_print().

## ◆ rb_ident_hash_new()

VALUE rb_ident_hash_new | ( | void |  | ) |

Definition at line 4443 of file hash.c.

References st_hash_type::hash, identhash, rb_hash_new(), RHASH_ST_TABLE_SET, and st_init_table.

Referenced by Init_Exception(), Init_sym(), rb_ast_add_mark_object(), rb_autoload_str(), and rb_uninterruptible().

## ◆ rb_interrupt()

void rb_interrupt | ( | void |  | ) |

Raises an `Interrupt` exception.

Definition at line 741 of file eval.c.

References rb_eInterrupt, rb_exc_new(), and rb_exc_raise().

Referenced by rb_signal_exec().

## ◆ rb_invalid_str()

void rb_invalid_str | ( | const char * | str,
|  | const char * | type
| ) |  |

Definition at line 2045 of file error.c.

References PRIsVALUE, rb_eArgError, rb_raise(), rb_str_new2, and str.

Referenced by rb_cstr_to_inum().

## ◆ rb_iseqw_local_variables()

VALUE rb_iseqw_local_variables | ( | VALUE | iseqval | ) |

Definition at line 3385 of file iseq.c.

References rb_iseq_local_variables().

## ◆ rb_iseqw_new()

VALUE rb_iseqw_new | ( | const rb_iseq_t * | iseq | ) |

Definition at line 1217 of file iseq.c.

Referenced by rb_debug_inspector_frame_iseq_get(), and rb_tracearg_instruction_sequence().

## ◆ rb_jump_tag()

void rb_jump_tag | ( | int | tag | ) |

Continues the exception caught by rb_protect() and rb_eval_string_protect().

This function never return to the caller.

Parameters

  [in] | the | value of `*state` which the protect function has set to the their last parameter.

Definition at line 921 of file eval.c.

References EC_JUMP_TAG, TAG_FATAL, unknown_longjmp_status, and UNLIKELY.

Referenced by ossl_buf2str(), ossl_membio2str(), ossl_pkey_new(), rb_execarg_parent_start(), and rb_f_exec().

## ◆ rb_key_err_new()

VALUE rb_key_err_new | ( | VALUE | mesg,
|  | VALUE | recv,
|  | VALUE | key
| ) |  |

Definition at line 2087 of file error.c.

References id_bt, id_mesg, key, Qnil, rb_eKeyError, rb_ivar_set(), and rb_obj_alloc().

## ◆ rb_load_fail()

void rb_load_fail | ( | VALUE | path,
|  | const char * | err
| ) |  |

Definition at line 3219 of file error.c.

References err, rb_str_append(), rb_str_buf_new_cstr, and rb_str_cat2.

## ◆ rb_loaderror()

void rb_loaderror | ( | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 2936 of file error.c.

References Qnil, rb_enc_vsprintf(), and rb_locale_encoding().

Referenced by dln_load(), and rb_f_require_relative().

## ◆ rb_loaderror_with_path()

void rb_loaderror_with_path | ( | VALUE | path,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 2948 of file error.c.

References rb_enc_vsprintf(), and rb_locale_encoding().

## ◆ rb_make_exception()

VALUE rb_make_exception | ( | int | argc,
|  | const VALUE * | argv
| ) |  |

Make an `Exception` object from the list of arguments in a manner similar to `Kernel#raise`.

Parameters

  [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.

Returns
  the exception object, or `Qnil` if `argc` is 0.

Definition at line 888 of file eval.c.

References argc, argv, and TRUE.

Referenced by rb_f_raise().

## ◆ rb_mod_sys_fail()

void rb_mod_sys_fail | ( | VALUE | mod,
|  | const char * | mesg
| ) |  |

Definition at line 3087 of file error.c.

References mod, rb_exc_raise(), and rb_extend_object().

## ◆ rb_mod_sys_fail_str()

void rb_mod_sys_fail_str | ( | VALUE | mod,
|  | VALUE | mesg
| ) |  |

Definition at line 3095 of file error.c.

References mod, rb_exc_raise(), and rb_extend_object().

## ◆ rb_mod_syserr_fail()

void rb_mod_syserr_fail | ( | VALUE | mod,
|  | int | e,
|  | const char * | mesg
| ) |  |

Definition at line 3103 of file error.c.

References mod, rb_exc_raise(), rb_extend_object(), and rb_syserr_new().

## ◆ rb_mod_syserr_fail_str()

void rb_mod_syserr_fail_str | ( | VALUE | mod,
|  | int | e,
|  | VALUE | mesg
| ) |  |

Definition at line 3111 of file error.c.

References mod, rb_exc_raise(), rb_extend_object(), and rb_syserr_new_str().

Referenced by rb_readwrite_syserr_fail().

## ◆ rb_name_err_new()

VALUE rb_name_err_new | ( | VALUE | mesg,
|  | VALUE | recv,
|  | VALUE | method
| ) |  |

Definition at line 1728 of file error.c.

References rb_eNameError, and rb_obj_alloc().

Referenced by rb_make_no_method_exception().

## ◆ rb_name_error()

void rb_name_error | ( | ID | id,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 1649 of file error.c.

References argv, ID2SYM, rb_class_new_instance(), rb_eNameError, rb_exc_raise(), and rb_vsprintf().

Referenced by rb_f_untrace_var(), rb_gvar_readonly_setter(), and rb_id_attrset().

## ◆ rb_name_error_str()

void rb_name_error_str | ( | VALUE | str,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 1664 of file error.c.

References argv, rb_class_new_instance(), rb_eNameError, rb_exc_raise(), rb_vsprintf(), and str.

Referenced by rb_f_untrace_var(), and rb_id_attrset().

## ◆ rb_nomethod_err_new()

VALUE rb_nomethod_err_new | ( | VALUE | mesg,
|  | VALUE | recv,
|  | VALUE | method,
|  | VALUE | args,
|  | int | priv
| ) |  |

Definition at line 1809 of file error.c.

References rb_eNoMethodError, and rb_obj_alloc().

Referenced by rb_make_no_method_exception().

## ◆ rb_notimplement()

void rb_notimplement | ( | void |  | ) |

Definition at line 2960 of file error.c.

References PRIsVALUE, rb_eNotImpError, rb_frame_this_func(), rb_id2str, and rb_raise().

Referenced by flock(), and rb_f_notimplement().

## ◆ rb_protect()

VALUE rb_protect | ( | VALUE(*)(VALUE) | proc,
|  | VALUE | data,
|  | int * | pstate
| ) |  |

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.

See also
  rb_rescue
  rb_rescue2
  rb_ensure

Definition at line 1105 of file eval.c.

References rb_execution_context_struct::cfp, EC_EXEC_TAG, EC_POP_TAG, EC_PUSH_TAG, MEMCPY, NULL, rb_vm_protect_tag::prev, rb_execution_context_struct::protect_tag, Qnil, rb_vm_rewind_cfp(), SAVE_ROOT_JMPBUF, and TAG_NONE.

Referenced by EVENTSINK_Invoke(), 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(), rb_execarg_parent_start(), and rb_f_exec().

## ◆ rb_raise()

void rb_raise | ( | VALUE | exc,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 2917 of file error.c.

References rb_vraise().

Referenced by Init_openssl(), ole_rec2variant(), ole_val_ary2variant_ary(), ole_variant2val(), ole_vstr2wc(), onigenc_single_byte_code_to_mbc(), rb_add_method_cfunc(), rb_alias(), rb_alias_variable(), rb_alloc_tmp_buffer(), rb_arithmetic_sequence_beg_len_step(), rb_ary_resize(), rb_ary_set_len(), rb_ary_store(), rb_ary_subseq_step(), rb_autoload(), rb_autoload_str(), rb_big2long(), rb_big2ulong(), rb_big_mul_karatsuba(), rb_big_mul_toom3(), rb_block_arity(), rb_block_min_max_arity(), rb_block_pair_yield_optimizable(), rb_bool_expected(), rb_check_id(), rb_check_inheritable(), rb_check_symbol(), rb_check_typeddata(), rb_class_inherited_p(), rb_class_superclass(), rb_cmperr(), rb_const_set(), rb_cstr_to_rat(), rb_current_receiver(), rb_declare_transcoder(), rb_default_home_dir(), rb_define_class(), rb_define_class_id_under(), rb_define_module(), rb_define_module_id_under(), rb_econv_append(), rb_econv_prepare_options(), rb_enc_associate_index(), rb_enc_check(), rb_enc_check_str(), rb_enc_codelen(), rb_enc_codepoint_len(), rb_enc_find_index(), rb_enc_register(), rb_enc_set_default_external(), rb_enc_str_new_cstr(), rb_enc_uint_chr(), rb_enc_vsprintf(), rb_eof_error(), rb_error_frozen(), rb_execarg_addopt(), rb_execarg_new(), rb_f_global_variables(), rb_f_raise(), rb_fiber_resume_kw(), rb_fiddle_generic_to_value(), rb_fiddle_int_to_ffi_type(), rb_fiddle_value_to_generic(), rb_file_expand_path_internal(), rb_fix2str(), rb_get_path_check_convert(), rb_Hash(), rb_hash_rehash(), rb_hash_set_default_proc(), rb_hash_set_pair(), rb_home_dir_of(), rb_include_module(), rb_int_cmp(), rb_int_powm(), rb_integer_unpack(), rb_invalid_str(), rb_io_check_byte_readable(), rb_io_check_char_readable(), rb_io_check_initialized(), rb_io_check_writable(), rb_io_extract_modeenc(), rb_io_modestr_fmode(), rb_io_popen(), rb_io_ungetc(), rb_iseq_build_from_ary(), rb_iseq_compile_node(), rb_iseq_ibf_dump(), rb_lambda_call(), rb_memory_view_prepare_item_desc(), rb_method_call_with_block_kw(), rb_must_asciicompat(), rb_mutex_unlock(), rb_nmin_run(), rb_notimplement(), rb_num2dbl(), rb_num2fix(), rb_num2long(), rb_num_get_rounding_option(), rb_num_zerodiv(), rb_obj_encoding(), rb_obj_init_copy(), rb_out_of_int(), rb_path_to_class(), rb_prepend_module(), rb_proc_isolate_bang(), rb_proc_ractor_make_shareable(), rb_random_real(), rb_random_ulong_limited(), rb_range_beg_len(), rb_reg_prepare_re0(), rb_reg_regsub(), rb_register_transcoder(), rb_set_errinfo(), rb_str_cat(), rb_str_cat_conv_enc_opts(), rb_str_concat(), rb_str_dump(), rb_str_ellipsize(), rb_str_format(), rb_str_modify_expand(), rb_str_plus(), rb_str_resize(), rb_str_set_len(), rb_str_setter(), rb_str_times(), rb_str_unlocktmp(), rb_str_update(), rb_string_value_cstr(), rb_struct_init_copy(), rb_struct_members(), rb_struct_s_members(), rb_sym2id(), rb_sym_proc_call(), rb_thread_stop(), rb_thread_wakeup(), rb_time_new(), rb_time_timespec_new(), rb_tracearg_eval_script(), rb_tracearg_instruction_sequence(), rb_tracearg_object(), rb_tracearg_parameters(), rb_tracearg_raised_exception(), rb_tracearg_return_value(), rb_tracepoint_enable(), rb_undef(), rb_undefined_alloc(), 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_getaddrinfo(), rsock_io_socket_addrinfo(), rsock_raise_socket_error(), rsock_revlookup_flag(), rsock_s_recvfrom(), rsock_s_recvfrom_nonblock(), RUBY_ALIAS_FUNCTION(), ruby_malloc_size_overflow(), st_foreach_safe(), val2variant_ptr(), VpAlloc(), and VpException().

## ◆ rb_report_bug_valist()

void rb_report_bug_valist | ( | VALUE | file,
|  | int | line,
|  | const char * | fmt,
|  | va_list | args
| ) |  |

Definition at line 839 of file error.c.

References NULL, report_bug_valist, and RSTRING_PTR.

## ◆ rb_rescue()

VALUE rb_rescue | ( | VALUE(*)(VALUE) | b_proc,
|  | VALUE | data1,
|  | VALUE(*)(VALUE, VALUE) | r_proc,
|  | VALUE | data2
| ) |  |

An equivalent of `rescue` clause.

Equivalent to `begin .. rescue .. end`.

It is same as

rb_rescue2(b_proc, data1, r_proc, data2, rb_eStandardError, (VALUE)0);
rb_rescue2
VALUE rb_rescue2(VALUE(*b_proc)(VALUE), VALUE data1, VALUE(*r_proc)(VALUE, VALUE), VALUE data2,...)
An equivalent of rescue clause.
Definition: eval.c:991
rb_eStandardError
VALUE rb_eStandardError
Definition: error.c:1054

See also
  rb_rescue2
  rb_ensure
  rb_protect

Definition at line 1080 of file eval.c.

References rb_eStandardError, and rb_rescue2().

## ◆ 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`

Parameters

  [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.

Returns
  the return value of b_proc if no exception occurs, or the return value of r_proc if otherwise.

See also
  rb_rescue
  rb_ensure
  rb_protect

Definition at line 991 of file eval.c.

References rb_vrescue2().

Referenced by rb_rescue().

## ◆ rb_set_errinfo()

void rb_set_errinfo | ( | VALUE | err | ) |

Sets the current exception (`$!`) to the given value.

Parameters

  [in] | err | an `Exception` object or `Qnil`.

Exceptions

  TypeError | if err is neither an exception nor `nil`.

Note
  this function does not raise the exception. Use `rb_raise()` when you want to raise.

Definition at line 1925 of file eval.c.

References err, NIL_P, rb_eException, rb_eTypeError, rb_obj_is_kind_of(), and rb_raise().

Referenced by ossl_pem_passwd_cb(), ossl_str_new(), ossl_verify_cb_call(), rb_reg_compile(), and ruby_require_internal().

## ◆ rb_str_end_with_asciichar()

int rb_str_end_with_asciichar | ( | VALUE | str,
|  | int | c
| ) |  |

Definition at line 7833 of file io.c.

References ENCODING_GET, len, ptr, rb_enc_ascget(), rb_enc_from_index(), rb_enc_mbminlen, RSTRING_LEN, RSTRING_PTR, and str.

Referenced by rb_io_puts().

## ◆ rb_syntax_error_append()

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 125 of file error.c.

References NIL_P, NULL, rb_attr_get(), rb_class_new_instance(), rb_enc_str_new(), rb_eSyntaxError, rb_str_cat2, rb_str_cat_cstr, rb_write_error_str(), RSTRING_LEN, and RSTRING_PTR.

## ◆ rb_sys_enc_warning()

void rb_sys_enc_warning | ( | rb_encoding * | enc,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 3197 of file error.c.

References RTEST, ruby_verbose, and with_warning_string.

## ◆ rb_sys_fail()

void rb_sys_fail | ( | const char * | mesg | ) |

Definition at line 3041 of file error.c.

References rb_exc_raise().

Referenced by rb_f_kill(), rb_io_wait(), rb_timespec_now(), rsock_bsock_send(), rsock_fd_socket_addrinfo(), rsock_make_fd_nonblock(), rsock_s_recvfrom(), rsock_sock_listen(), and ruby_getcwd().

## ◆ rb_sys_fail_str()

void rb_sys_fail_str | ( | VALUE | mesg | ) |

Definition at line 3047 of file error.c.

References rb_exc_raise().

Referenced by ruby_setenv().

## ◆ rb_sys_warning()

void rb_sys_warning | ( | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 3173 of file error.c.

References RTEST, ruby_verbose, and with_warning_string.

## ◆ rb_syserr_enc_warning()

void rb_syserr_enc_warning | ( | int | err,
|  | rb_encoding * | enc,
|  | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 3209 of file error.c.

References err, RTEST, ruby_verbose, and with_warning_string.

## ◆ rb_syserr_fail()

void rb_syserr_fail | ( | int | e,
|  | const char * | mesg
| ) |  |

Definition at line 3029 of file error.c.

References rb_exc_raise(), and rb_syserr_new().

Referenced by rb_fdopen(), rsock_init_sock(), rsock_raise_socket_error(), rsock_s_accept(), rsock_s_accept_nonblock(), rsock_s_recvfrom_nonblock(), rsock_syserr_fail_path(), and ruby_getcwd().

## ◆ rb_syserr_fail_str()

void rb_syserr_fail_str | ( | int | e,
|  | VALUE | mesg
| ) |  |

Definition at line 3035 of file error.c.

References rb_exc_raise(), and rb_syserr_new_str().

Referenced by rb_f_exec(), rsock_syserr_fail_host_port(), rsock_syserr_fail_path(), and rsock_syserr_fail_raddrinfo().

## ◆ rb_syserr_new()

VALUE rb_syserr_new | ( | int | n,
|  | const char * | mesg
| ) |  |

Definition at line 3015 of file error.c.

References Qnil, rb_str_new2, and rb_syserr_new_str().

Referenced by rb_mod_syserr_fail(), and rb_syserr_fail().

## ◆ rb_syserr_new_str()

VALUE rb_syserr_new_str | ( | int | n,
|  | VALUE | arg
| ) |  |

Definition at line 3023 of file error.c.

References rb_class_new_instance().

Referenced by rb_mod_syserr_fail_str(), rb_syserr_fail_str(), and rb_syserr_new().

## ◆ rb_typeddata_inherited_p()

int rb_typeddata_inherited_p | ( | const rb_data_type_t * | child,
|  | const rb_data_type_t * | parent
| ) |  |

Definition at line 997 of file error.c.

References rb_data_type_struct::parent.

Referenced by rb_check_typeddata(), and rb_typeddata_is_kind_of().

## ◆ rb_typeddata_is_instance_of()

int rb_typeddata_is_instance_of | ( | VALUE | obj,
|  | const rb_data_type_t * | data_type
| ) |  |

Definition at line 1018 of file error.c.

## ◆ rb_typeddata_is_kind_of()

int rb_typeddata_is_kind_of | ( | VALUE | obj,
|  | const rb_data_type_t * | data_type
| ) |  |

Definition at line 1007 of file error.c.

References rb_typeddata_inherited_p(), and T_DATA.

Referenced by rb_backtrace_p(), rb_obj_is_fiber(), rb_obj_is_method(), rb_obj_is_mutex(), rb_obj_is_proc(), rb_obj_is_thread(), and rb_ractor_p().

## ◆ rb_unexpected_type()

void rb_unexpected_type | ( | VALUE | x,
|  | int | t
| ) |  |

Definition at line 987 of file error.c.

References Qundef, rb_bug(), t, TYPE, and UNDEF_LEAKED.

## ◆ rb_vraise()

void rb_vraise | ( | VALUE | exc,
|  | const char * | fmt,
|  | va_list | ap
| ) |  |

Definition at line 2911 of file error.c.

References rb_exc_new3, rb_exc_raise(), and rb_vsprintf().

Referenced by rb_raise().

## ◆ rb_warn()

void rb_warn | ( | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 408 of file error.c.

References NIL_P, ruby_verbose, and with_warning_string.

Referenced by Init_continuation(), ossl_clear_error(), ossl_verify_cb_call(), rb_big_pow(), rb_complex_pow(), rb_define_const(), rb_enc_find_index(), rb_execarg_run_options(), rb_fdopen(), rb_hash_reject(), rb_io_extract_encoding_option(), rb_rational_pow(), rb_str_format(), rb_undef(), and VpCtoV().

## ◆ rb_warn_deprecated()

void rb_warn_deprecated | ( | const char * | fmt,
|  | const char * | suggest,
|  |  | ...
| ) |  |

Definition at line 480 of file error.c.

References ID2SYM, NIL_P, rb_str_cat_cstr, rb_str_catf(), rb_str_set_len(), RB_WARN_CATEGORY_DEPRECATED, rb_warning_category_enabled_p(), RSTRING_LEN, and ruby_verbose.

## ◆ rb_warn_deprecated_to_remove()

void rb_warn_deprecated_to_remove | ( | const char * | fmt,
|  | const char * | removal,
|  |  | ...
| ) |  |

Definition at line 496 of file error.c.

References ID2SYM, NIL_P, rb_str_catf(), rb_str_set_len(), RB_WARN_CATEGORY_DEPRECATED, rb_warning_category_enabled_p(), RSTRING_LEN, and ruby_verbose.

Referenced by rb_check_trusted(), rb_env_path_tainted(), rb_error_untrusted(), rb_obj_infect(), rb_obj_taint(), rb_obj_tainted(), rb_obj_trust(), rb_obj_untaint(), rb_obj_untrust(), rb_obj_untrusted(), rb_tainted_str_new(), and rb_tainted_str_new_cstr().

## ◆ rb_warning()

void rb_warning | ( | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 439 of file error.c.

References RTEST, ruby_verbose, and with_warning_string.

Referenced by asn1time_to_time(), ossl_pem_passwd_cb(), rb_attr(), rb_big2dbl(), rb_gv_get(), rb_gvar_undef_getter(), and rb_memory_view_register().

## ◆ rb_warning_category_enabled_p()

bool rb_warning_category_enabled_p | ( | rb_warning_category_t | category | ) |

Definition at line 182 of file error.c.

Referenced by rb_const_warn_if_deprecated(), rb_warn_deprecated(), rb_warn_deprecated_to_remove(), and yyparse().

## ◆ rb_warning_category_from_name()

rb_warning_category_t rb_warning_category_from_name | ( | VALUE | category | ) |

Definition at line 163 of file error.c.

References NUM2INT, PRIsVALUE, Qnil, rb_eArgError, rb_hash_aref(), rb_raise(), and T_SYMBOL.

## ◆ rb_warning_category_update()

void rb_warning_category_update | ( | unsigned int | mask,
|  | unsigned int | bits
| ) |  |

Definition at line 175 of file error.c.

References mask.

## ◆ rb_warning_string()

VALUE rb_warning_string | ( | const char * | fmt,
|  |  | ...
| ) |  |

Definition at line 460 of file error.c.

References with_warning_string.

## Variable Documentation

## ◆ rb_backtrace_length_limit

long rb_backtrace_length_limit = -1

Definition at line 68 of file error.c.

## ◆ rb_cNameErrorMesg

VALUE rb_cNameErrorMesg

Definition at line 1069 of file error.c.

Referenced by Init_Exception().

## ◆ rb_eArgError

VALUE rb_eArgError

Definition at line 1058 of file error.c.

Referenced by GetPrivPKeyPtr(), Init_date_core(), Init_Exception(), Init_vm_eval(), ossl_evp_get_cipherbyname(), rb_add_method_cfunc(), rb_alloc_tmp_buffer(), rb_ary_subseq_step(), rb_autoload(), rb_autoload_str(), rb_big_mul_karatsuba(), rb_big_mul_toom3(), rb_block_arity(), rb_block_min_max_arity(), rb_block_pair_yield_optimizable(), rb_bool_expected(), rb_cmperr(), rb_declare_transcoder(), rb_default_home_dir(), rb_define_class(), rb_define_class_id_under(), rb_econv_append(), rb_econv_prepare_options(), rb_enc_associate_index(), rb_enc_codelen(), rb_enc_codepoint_len(), rb_enc_find_index(), rb_enc_register(), rb_enc_set_default_external(), rb_enc_str_new_cstr(), rb_enc_vsprintf(), rb_execarg_addopt(), rb_execarg_new(), rb_f_raise(), rb_file_expand_path_internal(), rb_fix2str(), rb_get_path_check_convert(), rb_hash_set_pair(), rb_home_dir_of(), rb_include_module(), rb_integer_unpack(), rb_invalid_str(), rb_io_extract_modeenc(), rb_io_modestr_fmode(), rb_io_popen(), rb_iseq_compile_node(), rb_keyword_error_new(), rb_lambda_call(), rb_nmin_run(), rb_num_get_rounding_option(), rb_path_to_class(), rb_prepend_module(), rb_proc_isolate_bang(), rb_proc_ractor_make_shareable(), rb_reg_prepare_re0(), rb_register_transcoder(), rb_str_cat(), rb_str_format(), rb_str_modify_expand(), rb_str_plus(), rb_str_resize(), rb_str_times(), rb_string_value_cstr(), rb_sym_proc_call(), rb_time_timespec_new(), rb_tracepoint_enable(), rb_warning_category_from_name(), rb_xcalloc_mul_add_mul(), rb_xmalloc_mul_add(), rb_xmalloc_mul_add_mul(), rb_xrealloc_mul_add(), rb_yield_splat(), rb_yield_splat_kw(), rsock_revlookup_flag(), RUBY_ALIAS_FUNCTION(), ruby_malloc_size_overflow(), and VpAlloc().

## ◆ rb_eEAGAIN

VALUE rb_eEAGAIN

Definition at line 69 of file error.c.

Referenced by Init_IO().

## ◆ rb_eEINPROGRESS

VALUE rb_eEINPROGRESS

Definition at line 71 of file error.c.

Referenced by Init_IO().

## ◆ rb_eEncCompatError

VALUE rb_eEncCompatError

Definition at line 1064 of file error.c.

Referenced by Init_Exception(), rb_enc_check(), rb_enc_check_str(), rb_must_asciicompat(), and RUBY_ALIAS_FUNCTION().

## ◆ rb_eEncodingError

VALUE rb_eEncodingError

Definition at line 1063 of file error.c.

Referenced by Init_Exception(), and InitVM_transcode().

## ◆ rb_eEWOULDBLOCK

VALUE rb_eEWOULDBLOCK

Definition at line 70 of file error.c.

Referenced by Init_IO().

## ◆ rb_eException

VALUE rb_eException

Definition at line 1049 of file error.c.

Referenced by Init_eval_method(), Init_Exception(), Init_gdbm(), Init_Proc(), rb_get_backtrace(), and rb_set_errinfo().

## ◆ rb_eFatal

VALUE rb_eFatal

Definition at line 1053 of file error.c.

Referenced by Init_eval(), Init_Exception(), and rb_fatal().

## ◆ rb_eFrozenError

VALUE rb_eFrozenError

Definition at line 1056 of file error.c.

Referenced by Init_Exception(), rb_error_frozen(), rb_error_frozen_object(), and rb_frozen_error_raise().

## ◆ rb_eIndexError

VALUE rb_eIndexError

Definition at line 1059 of file error.c.

Referenced by Init_Exception(), InitVM_Enumerator(), rb_ary_resize(), rb_ary_store(), rb_str_cat_conv_enc_opts(), rb_str_ellipsize(), and rb_str_update().

## ◆ rb_eInterrupt

VALUE rb_eInterrupt

Definition at line 1051 of file error.c.

Referenced by Init_Exception(), Init_signal(), and rb_interrupt().

## ◆ rb_eKeyError

VALUE rb_eKeyError

Definition at line 1060 of file error.c.

Referenced by Init_Exception(), and rb_key_err_new().

## ◆ rb_eLoadError

VALUE rb_eLoadError

Definition at line 1074 of file error.c.

Referenced by Init_Exception().

## ◆ rb_eNameError

VALUE rb_eNameError

Definition at line 1062 of file error.c.

Referenced by Init_Exception(), rb_autoload_str(), rb_name_err_new(), rb_name_error(), and rb_name_error_str().

## ◆ rb_eNoMatchingPatternError

VALUE rb_eNoMatchingPatternError

Definition at line 1070 of file error.c.

Referenced by Init_Exception().

## ◆ rb_eNoMemError

VALUE rb_eNoMemError

Definition at line 1068 of file error.c.

Referenced by Init_Exception(), and Init_GC().

## ◆ rb_eNoMethodError

VALUE rb_eNoMethodError

Definition at line 1065 of file error.c.

Referenced by Init_Exception(), rb_make_no_method_exception(), and rb_nomethod_err_new().

## ◆ rb_eNotImpError

VALUE rb_eNotImpError

Definition at line 1067 of file error.c.

Referenced by Init_Exception(), rb_execarg_addopt(), rb_int_cmp(), and rb_notimplement().

## ◆ rb_eRangeError

VALUE rb_eRangeError

Definition at line 1061 of file error.c.

Referenced by Init_Exception(), Init_Numeric(), onigenc_single_byte_code_to_mbc(), rb_arithmetic_sequence_beg_len_step(), rb_big2long(), rb_big2ulong(), rb_enc_uint_chr(), rb_file_expand_path_internal(), rb_int_powm(), rb_num2fix(), rb_out_of_int(), rb_random_real(), rb_random_ulong_limited(), rb_range_beg_len(), rb_str_concat(), rb_time_new(), rb_uv_to_utf8(), and rb_vm_ifunc_new().

## ◆ rb_eRuntimeError

VALUE rb_eRuntimeError

Definition at line 1055 of file error.c.

Referenced by Init_cparse(), Init_Exception(), Init_openssl(), Init_ossl_ssl(), Init_pty(), Init_Ractor(), Init_win32ole_error(), ole_initialize(), ole_rec2variant(), ole_val_ary2variant_ary(), ole_variant2val(), ossl_bn_ctx_get(), ossl_evp_get_digestbyname(), rb_alias_variable(), rb_ary_set_len(), rb_current_receiver(), rb_fiddle_generic_to_value(), rb_fiddle_int_to_ffi_type(), rb_fiddle_value_to_generic(), rb_hash_rehash(), rb_iseq_ibf_dump(), rb_memory_view_prepare_item_desc(), rb_proc_isolate_bang(), rb_proc_ractor_make_shareable(), rb_reg_regsub(), rb_str_dump(), rb_str_set_len(), rb_str_unlocktmp(), rb_tracearg_eval_script(), rb_tracearg_instruction_sequence(), rb_tracearg_object(), rb_tracearg_parameters(), rb_tracearg_raised_exception(), rb_tracearg_return_value(), rb_vm_cbase(), rb_vm_make_binding(), RUBY_ALIAS_FUNCTION(), st_foreach_safe(), and val2variant_ptr().

## ◆ rb_eScriptError

VALUE rb_eScriptError

Definition at line 1072 of file error.c.

Referenced by Init_Exception().

## ◆ rb_eSecurityError

VALUE rb_eSecurityError

Definition at line 1066 of file error.c.

Referenced by Init_Exception().

## ◆ rb_eSignal

VALUE rb_eSignal

Definition at line 1052 of file error.c.

Referenced by Init_Exception(), Init_signal(), and rb_threadptr_signal_raise().

## ◆ rb_eStandardError

VALUE rb_eStandardError

Definition at line 1054 of file error.c.

Referenced by exp2(), Init_Cont(), Init_dbm(), Init_Exception(), Init_fiddle(), Init_gdbm(), Init_IO(), Init_Numeric(), Init_openssl(), Init_ossl_asn1(), Init_ossl_bn(), Init_ossl_cipher(), Init_ossl_config(), Init_ossl_digest(), Init_ossl_ec(), Init_ossl_engine(), Init_ossl_hmac(), Init_ossl_kdf(), Init_ossl_ns_spki(), Init_ossl_ocsp(), Init_ossl_pkcs12(), Init_ossl_pkcs7(), Init_ossl_pkey(), Init_ossl_rand(), Init_ossl_ssl(), Init_ossl_ssl_session(), Init_ossl_x509attr(), Init_ossl_x509cert(), Init_ossl_x509crl(), Init_ossl_x509ext(), Init_ossl_x509name(), Init_ossl_x509req(), Init_ossl_x509revoked(), Init_ossl_x509store(), Init_Proc(), Init_Regexp(), Init_strscan(), Init_Thread(), Init_zlib(), rb_rescue(), and rsock_init_socket_init().

## ◆ rb_eSyntaxError

VALUE rb_eSyntaxError

Definition at line 1073 of file error.c.

Referenced by Init_Exception(), and rb_syntax_error_append().

## ◆ rb_eSystemCallError

VALUE rb_eSystemCallError

Definition at line 1076 of file error.c.

Referenced by Init_Exception().

## ◆ rb_eSystemExit

VALUE rb_eSystemExit

Definition at line 1050 of file error.c.

Referenced by Init_Exception(), rb_exit(), rb_f_abort(), and rb_threadptr_signal_exit().

## ◆ rb_eTypeError

VALUE rb_eTypeError

Definition at line 1057 of file error.c.

Referenced by asn1integer_to_num(), asn1time_to_time(), Init_Exception(), num_to_asn1integer(), ossl_bn_value_ptr(), ossl_dh_new(), ossl_dsa_new(), ossl_ec_new(), ossl_rsa_new(), rb_alias(), rb_check_id(), rb_check_inheritable(), rb_check_symbol(), rb_check_typeddata(), rb_class_inherited_p(), rb_class_superclass(), rb_const_set(), rb_define_class(), rb_define_class_id_under(), rb_define_module(), rb_define_module_id_under(), rb_Hash(), rb_hash_set_default_proc(), rb_hash_set_pair(), rb_int_powm(), rb_iseq_build_from_ary(), rb_method_call_with_block_kw(), rb_num2dbl(), rb_num2long(), rb_obj_encoding(), rb_obj_init_copy(), rb_path_to_class(), rb_set_errinfo(), rb_str_setter(), rb_struct_init_copy(), rb_struct_members(), rb_struct_s_members(), rb_sym2id(), rb_undef(), rb_undefined_alloc(), rsock_io_socket_addrinfo(), and rsock_s_recvfrom().

## ◆ rb_mErrno

VALUE rb_mErrno

Definition at line 1077 of file error.c.

Referenced by Init_Exception().

## ◆ ruby_description

const char ruby_description[]
| extern

Definition at line 43 of file version.c.

Referenced by rb_assert_failure(), and rb_async_bug_errno().

## ◆ ruby_static_id_cause

ID ruby_static_id_cause

Definition at line 1080 of file error.c.