pub enum AspectError {
ExecutionError {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
WeavingError {
message: String,
},
Custom(Box<dyn Error + Send + Sync>),
}Expand description
Errors that can occur during aspect execution.
This type wraps errors that occur during the execution of advised functions or within aspect logic itself.
Variants§
ExecutionError
An error occurred during function execution
Fields
WeavingError
An error occurred during aspect weaving
Custom(Box<dyn Error + Send + Sync>)
A custom error defined by user code
Implementations§
Source§impl AspectError
impl AspectError
Sourcepub fn execution(message: impl Into<String>) -> Self
pub fn execution(message: impl Into<String>) -> Self
Creates a new execution error.
§Example
use aspect_core::error::AspectError;
let err = AspectError::execution("Database connection failed");Sourcepub fn execution_with_source(
message: impl Into<String>,
source: impl Error + Send + Sync + 'static,
) -> Self
pub fn execution_with_source( message: impl Into<String>, source: impl Error + Send + Sync + 'static, ) -> Self
Creates a new execution error with a source.
§Example
use aspect_core::error::AspectError;
use std::io;
let io_err = io::Error::new(io::ErrorKind::NotFound, "file not found");
let err = AspectError::execution_with_source("Failed to read file", io_err);Trait Implementations§
Source§impl Debug for AspectError
impl Debug for AspectError
Source§impl Display for AspectError
impl Display for AspectError
Source§impl Error for AspectError
impl Error for AspectError
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<&str> for AspectError
impl From<&str> for AspectError
Auto Trait Implementations§
impl Freeze for AspectError
impl !RefUnwindSafe for AspectError
impl Send for AspectError
impl Sync for AspectError
impl Unpin for AspectError
impl UnsafeUnpin for AspectError
impl !UnwindSafe for AspectError
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