pub trait RubyException: Error + 'static {
// Required methods
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§
sourcefn message(&self) -> Cow<'_, [u8]>
fn message(&self) -> Cow<'_, [u8]>
Message of the Exception
.
This value is a byte slice since Ruby String
s are equivalent to
Vec<u8>
.
sourcefn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>
fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>
Optional backtrace specified by a Vec
of frames.
sourcefn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>
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>
impl Error for Box<dyn RubyException>
1.30.0 · source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
source§impl From<CaughtException> for Box<dyn RubyException>
impl From<CaughtException> for Box<dyn RubyException>
source§fn from(exc: CaughtException) -> Self
fn from(exc: CaughtException) -> Self
Converts to this type from the input type.
source§impl RubyException for Box<dyn RubyException>
impl RubyException for Box<dyn RubyException>
source§fn vm_backtrace(&self, interp: &mut Artichoke) -> Option<Vec<Vec<u8>>>
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>
fn as_mrb_value(&self, interp: &mut Artichoke) -> Option<mrb_value>
Return a raise-able
sys::mrb_value
.