pub trait RubyException: Error + 'static {
    fn message(&self) -> Cow<'_, [u8]>;
    fn name(&self) -> Cow<'_, str>;
    fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>;
    fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>;
}
Expand description

Polymorphic exception type that corresponds to Ruby’s Exception.

All types that implement RubyException can be raised with error::raise. Rust code can re-raise a trait object to propagate exceptions from native code back into the interpreter.

Required Methods§

source

fn message(&self) -> Cow<'_, [u8]>

Message of the Exception.

This value is a byte slice since Ruby Strings are equivalent to Vec<u8>.

source

fn name(&self) -> Cow<'_, str>

Class name of the Exception.

source

fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>

Optional backtrace specified by a Vec of frames.

source

fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>

Return a raise-able sys::mrb_value.

Trait Implementations§

source§

impl Error for Box<dyn RubyException>

1.30.0 · source§

fn source(&self) -> Option<&(dyn Error + 'static)>

The lower-level source of this error, if any. Read more
1.0.0 · source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
source§

fn provide<'a>(&'a self, demand: &mut Demand<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
source§

impl From<CaughtException> for Box<dyn RubyException>

source§

fn from(exc: CaughtException) -> Self

Converts to this type from the input type.
source§

impl RubyException for Box<dyn RubyException>

source§

fn message(&self) -> Cow<'_, [u8]>

Message of the Exception. Read more
source§

fn name(&self) -> Cow<'_, str>

Class name of the Exception.
source§

fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>

Optional backtrace specified by a Vec of frames.
source§

fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>

Return a raise-able sys::mrb_value.

Implementations on Foreign Types§

source§

impl RubyException for Box<dyn RubyException>

source§

fn message(&self) -> Cow<'_, [u8]>

source§

fn name(&self) -> Cow<'_, str>

source§

fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>

source§

fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>

source§

impl RubyException for DomainError

source§

fn message(&self) -> Cow<'_, [u8]>

source§

fn name(&self) -> Cow<'_, str>

source§

fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>

source§

fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>

source§

impl RubyException for SymbolOverflowError

source§

fn message(&self) -> Cow<'_, [u8]>

source§

fn name(&self) -> Cow<'_, str>

source§

fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>

source§

fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>

source§

impl RubyException for ConvertBytesError

source§

fn message(&self) -> Cow<'_, [u8]>

source§

fn name(&self) -> Cow<'_, str>

source§

fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>

source§

fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>

Implementors§

source§

impl RubyException for IncrementLinenoError

source§

impl RubyException for NotDefinedError

source§

impl RubyException for NoBlockGiven

source§

impl RubyException for BoxIntoRubyError

source§

impl RubyException for UnboxRubyError

source§

impl RubyException for ConstantNameError

source§

impl RubyException for CaughtException

source§

impl RubyException for InterpreterExtractError

source§

impl RubyException for WriteError

source§

impl RubyException for ArenaSavepointError

source§

impl RubyException for ArgumentError

source§

impl RubyException for EOFError

source§

impl RubyException for EncodingError

source§

impl RubyException for Exception

source§

impl RubyException for Fatal

source§

impl RubyException for FiberError

source§

impl RubyException for FloatDomainError

source§

impl RubyException for FrozenError

source§

impl RubyException for IOError

source§

impl RubyException for IndexError

source§

impl RubyException for Interrupt

source§

impl RubyException for KeyError

source§

impl RubyException for LoadError

source§

impl RubyException for LocalJumpError

source§

impl RubyException for NameError

source§

impl RubyException for NoMemoryError

source§

impl RubyException for NoMethodError

source§

impl RubyException for NotImplementedError

source§

impl RubyException for RangeError

source§

impl RubyException for RegexpError

source§

impl RubyException for RuntimeError

source§

impl RubyException for ScriptError

source§

impl RubyException for SecurityError

source§

impl RubyException for SignalException

source§

impl RubyException for StandardError

source§

impl RubyException for StopIteration

source§

impl RubyException for SyntaxError

source§

impl RubyException for SystemCallError

source§

impl RubyException for SystemExit

source§

impl RubyException for SystemStackError

source§

impl RubyException for ThreadError

source§

impl RubyException for TypeError

source§

impl RubyException for UncaughtThrowError

source§

impl RubyException for ZeroDivisionError

source§

impl RubyException for ArgCountError

source§

impl RubyException for Error