pub struct Error { /* private fields */ }Implementations§
Source§impl Error
impl Error
Sourcepub fn new(kind: ErrorKind, operation: &'static str) -> Self
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).
Sourcepub fn with_message(self, message: impl Into<String>) -> Self
pub fn with_message(self, message: impl Into<String>) -> Self
Set the human-readable error message.
Sourcepub fn with_operation(self, operation: &'static str) -> Self
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.
Sourcepub fn with_context(self, key: &'static str, value: impl Into<String>) -> Self
pub fn with_context(self, key: &'static str, value: impl Into<String>) -> Self
Attach a key-value context pair for debugging.
Sourcepub fn set_source<E>(self, source: E) -> Self
pub fn set_source<E>(self, source: E) -> Self
Attach an underlying source error.
Accepts any source error that is safe to store and report from this library’s public error type.
Sourcepub fn set_temporary(self) -> Self
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.
Sourcepub fn set_permanent(self) -> Self
pub fn set_permanent(self) -> Self
Record a permanent source condition: retrying the same request will not help without external changes.
Sourcepub fn set_persistent(self) -> Self
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.
Sourcepub fn status(&self) -> ErrorStatus
pub fn status(&self) -> ErrorStatus
The retry status of this error.
Sourcepub fn allocation_source(&self) -> AllocationSource
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.
Sourcepub fn allocation_failure_source(&self) -> AllocationFailureSource
pub fn allocation_failure_source(&self) -> AllocationFailureSource
Which owner or device condition caused this allocation failure.
Sourcepub fn allocation_domain_id(&self) -> u64
pub fn allocation_domain_id(&self) -> u64
Stable domain identity supplied by the native allocation owner.
Sourcepub fn allocation_member_id(&self) -> u64
pub fn allocation_member_id(&self) -> u64
Stable member identity supplied by the native allocation owner.
Sourcepub fn allocation_generation(&self) -> u64
pub fn allocation_generation(&self) -> u64
Native generation for the allocation owner identity.
Sourcepub fn allocation_requested_bytes(&self) -> u64
pub fn allocation_requested_bytes(&self) -> u64
Bytes requested by the failed allocation, when known.
Sourcepub fn allocation_alignment(&self) -> u64
pub fn allocation_alignment(&self) -> u64
Alignment requested by the failed allocation, when known.
Sourcepub fn allocation_cuda_error(&self) -> i32
pub fn allocation_cuda_error(&self) -> i32
CUDA status observed at the allocation boundary, or -1 when absent.
Sourcepub fn is_temporary(&self) -> bool
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.
Sourcepub fn is_permanent(&self) -> bool
pub fn is_permanent(&self) -> bool
Whether the source reported a permanent condition.
Sourcepub fn is_persistent(&self) -> bool
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.
Sourcepub fn operation(&self) -> &'static str
pub fn operation(&self) -> &'static str
The operation that was being performed when the error occurred.
Sourcepub fn context_value(&self, key: &str) -> Option<&str>
pub fn context_value(&self, key: &str) -> Option<&str>
Returns one structured context value by key.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()