Ruby: include/ruby/internal/error.h File Reference

Ruby 3.4.3p32 (2025-04-14 revision d0b7e5b6a04bde21ca483d20a1546b28b401c2d4)

Macros | Enumerations | Functions
error.h File Reference

Declares rb_raise(). More...

`#include "ruby/internal/attr/cold.h"`
`#include "ruby/internal/attr/format.h"`
`#include "ruby/internal/attr/noreturn.h"`
`#include "ruby/internal/attr/nonnull.h"`
`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/value.h"`

Go to the source code of this file.

## Macros
#define | ruby_verbose (*rb_ruby_verbose_ptr())
| This variable controls whether the interpreter is in debug mode.
#define | ruby_debug (*rb_ruby_debug_ptr())
| This variable controls whether the interpreter is in debug mode.

## Enumerations
enum | rb_warning_category_t { RB_WARN_CATEGORY_NONE , RB_WARN_CATEGORY_DEPRECATED , RB_WARN_CATEGORY_EXPERIMENTAL , RB_WARN_CATEGORY_PERFORMANCE , RB_WARN_CATEGORY_STRICT_UNUSED_BLOCK , RB_WARN_CATEGORY_DEFAULT_BITS , RB_WARN_CATEGORY_ALL_BITS }
| Warning categories. More...
enum | rb_io_wait_readwrite { RB_IO_WAIT_READABLE , RB_IO_WAIT_WRITABLE }
| for rb_readwrite_sys_fail first argument More...

## Functions
VALUE | rb_errinfo (void)
| This is the same as `$!` in Ruby.
void | rb_set_errinfo (VALUE err)
| Sets the current exception (`$!`) to the given value.
void | rb_raise (VALUE exc, const char *fmt,...)
| Exception entry point.
void | rb_fatal (const char *fmt,...)
| Raises the unsung "fatal" exception.
void | rb_bug (const char *fmt,...)
| Interpreter panic switch.
void | rb_bug_errno (const char *msg, int err)
| This is a wrapper of rb_bug() which automatically constructs appropriate message from the passed errno.
void | rb_sys_fail (const char *msg)
| Converts a C errno into a Ruby exception, then raises it.
void | rb_sys_fail_str (VALUE msg)
| Identical to rb_sys_fail(), except it takes the message in Ruby's String instead of C's.
void | rb_mod_sys_fail (VALUE mod, const char *msg)
| Identical to rb_sys_fail(), except it takes additional module to extend the exception object before raising.
void | rb_mod_sys_fail_str (VALUE mod, VALUE msg)
| Identical to rb_mod_sys_fail(), except it takes the message in Ruby's String instead of C's.
void | rb_readwrite_sys_fail (enum rb_io_wait_readwrite waiting, const char *msg)
| Raises appropriate exception using the parameters.
void | rb_iter_break (void)
| Breaks from a block.
void | rb_iter_break_value (VALUE val)
| Identical to rb_iter_break(), except it additionally takes the "value" of this breakage.
void | rb_exit (int status)
| Terminates the current execution context.
void | rb_notimplement (void)
VALUE | rb_syserr_new (int err, const char *msg)
| Creates an exception object that represents the given C errno.
VALUE | rb_syserr_new_str (int n, VALUE arg)
| Identical to rb_syserr_new(), except it takes the message in Ruby's String instead of C's.
void | rb_syserr_fail (int err, const char *msg)
| Raises appropriate exception that represents a C errno.
void | rb_syserr_fail_str (int err, VALUE msg)
| Identical to rb_syserr_fail(), except it takes the message in Ruby's String instead of C's.
void | rb_mod_syserr_fail (VALUE mod, int err, const char *msg)
| Identical to rb_mod_sys_fail(), except it does not depend on C global variable errno.
void | rb_mod_syserr_fail_str (VALUE mod, int err, VALUE msg)
| Identical to rb_mod_syserr_fail(), except it takes the message in Ruby's String instead of C's.
void | rb_readwrite_syserr_fail (enum rb_io_wait_readwrite waiting, int err, const char *msg)
| Identical to rb_readwrite_sys_fail(), except it does not depend on C global variable errno.
void | rb_unexpected_type (VALUE self, int t)
| Fails with the given object's type incompatibility to the type.
void | rb_warning (const char *fmt,...)
| Issues a warning.
void | rb_category_warning (rb_warning_category_t cat, const char *fmt,...)
| Identical to rb_warning(), except it takes additional "category" parameter.
void | rb_compile_warning (const char *file, int line, const char *fmt,...)
| Issues a compile-time warning that happens at `__file__:__line__`.
void | rb_sys_warning (const char *fmt,...)
| Identical to rb_sys_fail(), except it does not raise an exception to render a warning instead.
void | rb_warn (const char *fmt,...)
| Identical to rb_warning(), except it reports unless $VERBOSE is nil.
void | rb_category_warn (rb_warning_category_t cat, const char *fmt,...)
| Identical to rb_category_warning(), except it reports unless $VERBOSE is nil.
void | rb_compile_warn (const char *file, int line, const char *fmt,...)
| Identical to rb_compile_warning(), except it reports unless $VERBOSE is nil.
void | rb_category_compile_warn (rb_warning_category_t cat, const char *file, int line, const char *fmt,...)
| Identical to rb_compile_warn(), except it also accepts category.

## Detailed Description

Declares rb_raise().

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

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.