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
.