Skip to main content

Error

Struct Error 

Source
pub struct Error { /* private fields */ }

Implementations§

Source§

impl Error

Source

pub fn new(kind: ErrorKind, operation: &'static str) -> Self

Create a new error for the given kind and operation.

The error defaults to ErrorStatus::Permanent. A backtrace is captured only for ErrorKind::Unexpected errors (when the RUST_BACKTRACE environment variable is set).

Source

pub fn with_message(self, message: impl Into<String>) -> Self

Set the human-readable error message.

Source

pub fn with_operation(self, operation: &'static str) -> Self

Set the operation, stacking the previous one as context.

If an operation is already set, it is preserved as ("called", old_operation) context, creating a logical call chain for debugging.

Source

pub fn with_context(self, key: &'static str, value: impl Into<String>) -> Self

Attach a key-value context pair for debugging.

Source

pub fn set_source<E>(self, source: E) -> Self
where E: StdError + Send + Sync + 'static,

Attach an underlying source error.

Accepts any source error that is safe to store and report from this library’s public error type.

Source

pub fn set_temporary(self) -> Self

Record a transient source condition.

This marks the observation only. Retry remains the caller’s decision after its cleanup and device-health checks.

Source

pub fn set_permanent(self) -> Self

Record a permanent source condition: retrying the same request will not help without external changes.

Source

pub fn set_persistent(self) -> Self

Record a continuing source condition.

A fatal probe result can set this status directly, without any retry having happened. Callers must stop automatic retry, finish cleanup, and escalate.

Source

pub fn kind(&self) -> ErrorKind

The kind of this error.

Source

pub fn status(&self) -> ErrorStatus

The retry status of this error.

Source

pub fn allocation_source(&self) -> AllocationSource

Which allocation-failure exception type produced this error.

This is Unknown unless the C error object explicitly classified an allocation failure. It reports only the caught exception type and is never inferred from message text or error status.

Source

pub fn allocation_failure_source(&self) -> AllocationFailureSource

Which owner or device condition caused this allocation failure.

Source

pub fn allocation_domain_id(&self) -> u64

Stable domain identity supplied by the native allocation owner.

Source

pub fn allocation_member_id(&self) -> u64

Stable member identity supplied by the native allocation owner.

Source

pub fn allocation_generation(&self) -> u64

Native generation for the allocation owner identity.

Source

pub fn allocation_requested_bytes(&self) -> u64

Bytes requested by the failed allocation, when known.

Source

pub fn allocation_alignment(&self) -> u64

Alignment requested by the failed allocation, when known.

Source

pub fn allocation_cuda_error(&self) -> i32

CUDA status observed at the allocation boundary, or -1 when absent.

Source

pub fn is_temporary(&self) -> bool

Whether the source reported a transient condition.

This is the observation and does not permit a retry. The caller must still complete cleanup and device-health checks first.

Source

pub fn is_permanent(&self) -> bool

Whether the source reported a permanent condition.

Source

pub fn is_persistent(&self) -> bool

Whether the source reported a continuing condition.

This status can be set directly by a fatal probe result without any retry having happened.

Source

pub fn operation(&self) -> &'static str

The operation that was being performed when the error occurred.

Source

pub fn message(&self) -> &str

The human-readable error message, if any.

Source

pub fn context_value(&self, key: &str) -> Option<&str>

Returns one structured context value by key.

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

Source§

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

👎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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin 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§

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>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.