Ruby  3.4.0dev (2024-12-06 revision 892c46283a5ea4179500d951c9d4866c0051f27b)
Macros | Functions
error.h File Reference

(892c46283a5ea4179500d951c9d4866c0051f27b)

Public APIs related to rb_eException. More...

#include "ruby/internal/attr/format.h"
#include "ruby/internal/attr/noreturn.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"
#include "ruby/internal/fl_type.h"
#include "ruby/backward/2/assume.h"
Include dependency graph for error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UNLIMITED_ARGUMENTS   (-1)
 This macro is used in conjunction with rb_check_arity(). More...
 
#define rb_exc_new2   rb_exc_new_cstr
 Old name of rb_exc_new_cstr. More...
 
#define rb_exc_new3   rb_exc_new_str
 Old name of rb_exc_new_str. More...
 
#define rb_check_frozen_internal   rb_check_frozen
 
#define rb_check_frozen   rb_check_frozen_inline
 

Functions

VALUE rb_exc_new (VALUE etype, const char *ptr, long len)
 Creates an instance of the passed exception class. More...
 
VALUE rb_exc_new_cstr (VALUE etype, const char *str)
 Identical to rb_exc_new(), except it assumes the passed pointer is a pointer to a C string. More...
 
VALUE rb_exc_new_str (VALUE etype, VALUE str)
 Identical to rb_exc_new_cstr(), except it takes a Ruby's string instead of C's. More...
 
void rb_loaderror (const char *fmt,...)
 Raises an instance of rb_eLoadError. More...
 
void rb_loaderror_with_path (VALUE path, const char *fmt,...)
 Identical to rb_loaderror(), except it additionally takes which file is unable to load. More...
 
void rb_name_error (ID name, const char *fmt,...)
 Raises an instance of rb_eNameError. More...
 
void rb_name_error_str (VALUE name, const char *fmt,...)
 Identical to rb_name_error(), except it takes a VALUE instead of ID. More...
 
void rb_frozen_error_raise (VALUE recv, const char *fmt,...)
 Raises an instance of rb_eFrozenError. More...
 
void rb_invalid_str (const char *str, const char *type)
 Honestly I don't understand the name, but it raises an instance of rb_eArgError. More...
 
void rb_error_frozen (const char *what)
 Identical to rb_frozen_error_raise(), except its raising exception has a message like "can't modify frozen /what/". More...
 
void rb_error_frozen_object (VALUE what)
 Identical to rb_error_frozen(), except it takes arbitrary Ruby object instead of C's string. More...
 
void rb_check_frozen (VALUE obj)
 Queries if the passed object is frozen. More...
 
void rb_check_copyable (VALUE obj, VALUE orig)
 Ensures that the passed object can be initialize_copy relationship. More...
 
void rb_str_modify (VALUE str)
 
static void rb_check_frozen_inline (VALUE obj)
 Just another name of rb_check_frozen. More...
 
static int rb_check_arity (int argc, int min, int max)
 Ensures that the passed integer is in the passed range. More...
 

Detailed Description

Public APIs related to rb_eException.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
Warning
Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
Note
To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file error.h.

Macro Definition Documentation

◆ rb_check_frozen_internal

#define rb_check_frozen_internal   rb_check_frozen
Deprecated:

Does anyone use this? Remain not deleted for compatibility.

Definition at line 249 of file error.h.

◆ UNLIMITED_ARGUMENTS

#define UNLIMITED_ARGUMENTS   (-1)

This macro is used in conjunction with rb_check_arity().

If you pass it to the function's last (max) argument, that means the function does not check upper limit.

Definition at line 35 of file error.h.

Function Documentation

◆ rb_check_arity()

static int rb_check_arity ( int  argc,
int  min,
int  max 
)
inlinestatic

Ensures that the passed integer is in the passed range.

When you can use rb_scan_args() that is preferred over this one (powerful, descriptive). But it can have its own application area.

Parameters
[in]argcArbitrary integer.
[in]minMinimum allowed argv.
[in]maxMaximum allowed argv, or UNLIMITED_ARGUMENTS.
Exceptions
rb_eArgErrorargc out of range.
Returns
The passed argc.
Postcondition
Upon successful return argc is in range of min..max, both inclusive.

Definition at line 284 of file error.h.

Referenced by rb_ary_aref(), rb_f_abort(), rb_f_exit(), rb_f_kill(), rb_file_s_absolute_path(), rb_file_s_expand_path(), rb_mod_class_variables(), rb_mod_constants(), and rb_obj_singleton_methods().

◆ rb_check_frozen_inline()

static void rb_check_frozen_inline ( VALUE  obj)
inlinestatic

Just another name of rb_check_frozen.

Definition at line 253 of file error.h.

Referenced by rb_check_frozen().