pub struct ActorError {
pub code: ErrorCode,
pub message: String,
pub details: Option<String>,
pub cause: Option<Box<ActorError>>,
}Expand description
An error originating from within an actor’s handler or lifecycle hook.
Structured error type for actor handler failures. Inspired by gRPC status codes — carries a code, message, optional details, and an error chain for causal tracing.
Fields§
§code: ErrorCodeThe error category (e.g., Internal, InvalidArgument, NotFound).
message: StringHuman-readable error description.
details: Option<String>Optional structured details (JSON string or domain-specific data).
cause: Option<Box<ActorError>>Causal chain — the error that caused this one.
Implementations§
Source§impl ActorError
impl ActorError
Sourcepub fn new(code: ErrorCode, message: impl Into<String>) -> Self
pub fn new(code: ErrorCode, message: impl Into<String>) -> Self
Create a simple error with code and message.
Sourcepub fn internal(message: impl Into<String>) -> Self
pub fn internal(message: impl Into<String>) -> Self
Create an internal error (most common for unexpected failures).
Sourcepub fn with_details(self, details: impl Into<String>) -> Self
pub fn with_details(self, details: impl Into<String>) -> Self
Add details to the error.
Sourcepub fn with_cause(self, cause: ActorError) -> Self
pub fn with_cause(self, cause: ActorError) -> Self
Chain a cause to this error.
Trait Implementations§
Source§impl Clone for ActorError
impl Clone for ActorError
Source§fn clone(&self) -> ActorError
fn clone(&self) -> ActorError
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ActorError
impl Debug for ActorError
Source§impl Display for ActorError
impl Display for ActorError
Source§impl Error for ActorError
impl Error for ActorError
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()
Auto Trait Implementations§
impl Freeze for ActorError
impl RefUnwindSafe for ActorError
impl Send for ActorError
impl Sync for ActorError
impl Unpin for ActorError
impl UnsafeUnpin for ActorError
impl UnwindSafe for ActorError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more