pub struct Error(/* private fields */);
Expand description

The Error type, a wrapper around a dynamic exception type.

Error works a lot like Box<dyn std::error::Error>, but with these differences:

  • Error requires that the error is 'static.
  • Error requires that the error implement RubyException.
  • Error can convert itself to a backtrace on the underlying Ruby VM.

All types that implement RubyException are able to be converted to Error.

Trait Implementations§

source§

impl Debug for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for Error

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Error for Error

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, request: &mut Request<'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<ArenaSavepointError> for Error

source§

fn from(exception: ArenaSavepointError) -> Self

Converts to this type from the input type.
source§

impl From<ArgCountError> for Error

source§

fn from(exception: ArgCountError) -> Self

Converts to this type from the input type.
source§

impl From<ArgumentError> for Error

source§

fn from(err: EnvArgumentError) -> Self

Converts to this type from the input type.
source§

impl From<ArgumentError> for Error

source§

fn from(exception: ArgumentError) -> Error

Converts to this type from the input type.
source§

impl From<ArgumentError> for Error

source§

fn from(err: ArgumentError) -> Self

Converts to this type from the input type.
source§

impl From<ArgumentError> for Error

source§

fn from(err: ArgumentError) -> Self

Converts to this type from the input type.
source§

impl From<Box<dyn RubyException>> for Error

source§

fn from(exc: Box<dyn RubyException>) -> Self

Converts to this type from the input type.
source§

impl From<BoxIntoRubyError> for Error

source§

fn from(exception: BoxIntoRubyError) -> Self

Converts to this type from the input type.
source§

impl From<CaughtException> for Error

source§

fn from(exc: CaughtException) -> Self

Converts to this type from the input type.
source§

impl From<ConstantNameError> for Error

source§

fn from(exception: ConstantNameError) -> Self

Converts to this type from the input type.
source§

impl From<ConvertBytesError> for Error

source§

fn from(exception: ConvertBytesError) -> Self

Converts to this type from the input type.
source§

impl From<DomainError> for Error

source§

fn from(err: DomainError) -> Self

Converts to this type from the input type.
source§

impl From<DomainError> for Error

source§

fn from(exception: DomainError) -> Self

Converts to this type from the input type.
source§

impl From<EOFError> for Error

source§

fn from(exception: EOFError) -> Error

Converts to this type from the input type.
source§

impl From<EncodingError> for Error

source§

fn from(exception: EncodingError) -> Error

Converts to this type from the input type.
source§

impl<'a> From<Error<'a>> for Error

source§

fn from(err: Error<'a>) -> Self

Converts to this type from the input type.
source§

impl From<Error> for Error

source§

fn from(err: EnvError) -> Self

Converts to this type from the input type.
source§

impl From<Error> for Error

source§

fn from(err: MathError) -> Self

Converts to this type from the input type.
source§

impl From<Error> for Error

source§

fn from(err: Error) -> Self

Converts to this type from the input type.
source§

impl From<Error> for Error

source§

fn from(err: SecureRandomError) -> Self

Converts to this type from the input type.
source§

impl From<Exception> for Error

source§

fn from(exception: Exception) -> Error

Converts to this type from the input type.
source§

impl From<Fatal> for Error

source§

fn from(exception: Fatal) -> Error

Converts to this type from the input type.
source§

impl From<FiberError> for Error

source§

fn from(exception: FiberError) -> Error

Converts to this type from the input type.
source§

impl From<FloatDomainError> for Error

source§

fn from(exception: FloatDomainError) -> Error

Converts to this type from the input type.
source§

impl From<FrozenError> for Error

source§

fn from(exception: FrozenError) -> Error

Converts to this type from the input type.
source§

impl From<IOError> for Error

source§

fn from(exception: IOError) -> Error

Converts to this type from the input type.
source§

impl From<IncrementLinenoError> for Error

source§

fn from(exception: IncrementLinenoError) -> Self

Converts to this type from the input type.
source§

impl From<IndexError> for Error

source§

fn from(exception: IndexError) -> Error

Converts to this type from the input type.
source§

impl From<InitializeError> for Error

source§

fn from(err: InitializeError) -> Self

Converts to this type from the input type.
source§

impl From<InterpreterExtractError> for Error

source§

fn from(exception: InterpreterExtractError) -> Self

Converts to this type from the input type.
source§

impl From<Interrupt> for Error

source§

fn from(exception: Interrupt) -> Error

Converts to this type from the input type.
source§

impl From<InvalidError> for Error

source§

fn from(err: InvalidError) -> Self

Converts to this type from the input type.
source§

impl From<KeyError> for Error

source§

fn from(exception: KeyError) -> Error

Converts to this type from the input type.
source§

impl From<LoadError> for Error

source§

fn from(exception: LoadError) -> Error

Converts to this type from the input type.
source§

impl From<LocalJumpError> for Error

source§

fn from(exception: LocalJumpError) -> Error

Converts to this type from the input type.
source§

impl From<NameError> for Error

source§

fn from(exception: NameError) -> Error

Converts to this type from the input type.
source§

impl From<NewSeedError> for Error

source§

fn from(err: NewSeedError) -> Self

Converts to this type from the input type.
source§

impl From<NoBlockGiven> for Error

source§

fn from(exception: NoBlockGiven) -> Self

Converts to this type from the input type.
source§

impl From<NoMemoryError> for Error

source§

fn from(exception: NoMemoryError) -> Error

Converts to this type from the input type.
source§

impl From<NoMethodError> for Error

source§

fn from(exception: NoMethodError) -> Error

Converts to this type from the input type.
source§

impl From<NotDefinedError> for Error

source§

fn from(exception: NotDefinedError) -> Self

Converts to this type from the input type.
source§

impl From<NotImplementedError> for Error

source§

fn from(err: MathNotImplementedError) -> Self

Converts to this type from the input type.
source§

impl From<NotImplementedError> for Error

source§

fn from(exception: NotImplementedError) -> Error

Converts to this type from the input type.
source§

impl From<RandomBytesError> for Error

source§

fn from(err: RandomBytesError) -> Self

Converts to this type from the input type.
source§

impl From<RangeError> for Error

source§

fn from(exception: RangeError) -> Error

Converts to this type from the input type.
source§

impl From<RegexpError> for Error

source§

fn from(exception: RegexpError) -> Error

Converts to this type from the input type.
source§

impl From<RuntimeError> for Error

source§

fn from(exception: RuntimeError) -> Error

Converts to this type from the input type.
source§

impl From<ScriptError> for Error

source§

fn from(exception: ScriptError) -> Error

Converts to this type from the input type.
source§

impl From<SecurityError> for Error

source§

fn from(exception: SecurityError) -> Error

Converts to this type from the input type.
source§

impl From<SignalException> for Error

source§

fn from(exception: SignalException) -> Error

Converts to this type from the input type.
source§

impl From<StandardError> for Error

source§

fn from(exception: StandardError) -> Error

Converts to this type from the input type.
source§

impl From<StopIteration> for Error

source§

fn from(exception: StopIteration) -> Error

Converts to this type from the input type.
source§

impl From<SymbolOverflowError> for Error

source§

fn from(exception: SymbolOverflowError) -> Self

Converts to this type from the input type.
source§

impl From<SyntaxError> for Error

source§

fn from(exception: SyntaxError) -> Error

Converts to this type from the input type.
source§

impl From<SystemCallError> for Error

source§

fn from(exception: SystemCallError) -> Error

Converts to this type from the input type.
source§

impl From<SystemExit> for Error

source§

fn from(exception: SystemExit) -> Error

Converts to this type from the input type.
source§

impl From<SystemStackError> for Error

source§

fn from(exception: SystemStackError) -> Error

Converts to this type from the input type.
source§

impl From<ThreadError> for Error

source§

fn from(exception: ThreadError) -> Error

Converts to this type from the input type.
source§

impl From<TimeError> for Error

source§

fn from(error: TimeError) -> Error

Converts to this type from the input type.
source§

impl From<TypeError> for Error

source§

fn from(exception: TypeError) -> Error

Converts to this type from the input type.
source§

impl From<UnboxRubyError> for Error

source§

fn from(exception: UnboxRubyError) -> Self

Converts to this type from the input type.
source§

impl From<UncaughtThrowError> for Error

source§

fn from(exception: UncaughtThrowError) -> Error

Converts to this type from the input type.
source§

impl From<UrandomError> for Error

source§

fn from(err: UrandomError) -> Self

Converts to this type from the input type.
source§

impl From<WriteError> for Error

source§

fn from(exception: WriteError) -> Self

Converts to this type from the input type.
source§

impl From<ZeroDivisionError> for Error

source§

fn from(exception: ZeroDivisionError) -> Error

Converts to this type from the input type.
source§

impl RubyException for Error

source§

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

Class name of the Exception.

source§

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

Message of the Exception. Read more
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.

Auto Trait Implementations§

§

impl Freeze for Error

§

impl !RefUnwindSafe for Error

§

impl !Send for Error

§

impl !Sync for Error

§

impl Unpin for Error

§

impl !UnwindSafe for Error

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.