pub struct CuError { /* private fields */ }Expand description
Common copper Error type.
This error type stores an optional cause as a boxed dynamic error, allowing for proper error chaining while maintaining Clone and Serialize/Deserialize support through custom implementations.
Implementations§
Source§impl CuError
impl CuError
Sourcepub fn new(message_index: usize) -> CuError
pub fn new(message_index: usize) -> CuError
Creates a new CuError from an interned string index. Used by the cu_error! macro.
The index is stored as a placeholder string [interned:{index}].
Actual string resolution happens at logging time via the unified logger.
Sourcepub fn new_with_cause<E>(message: &str, cause: E) -> CuError
pub fn new_with_cause<E>(message: &str, cause: E) -> CuError
Creates a new CuError with a message and an underlying cause.
§Example
use cu29_traits::CuError;
let io_err = std::io::Error::other("io error");
let err = CuError::new_with_cause("Failed to read file", io_err);Sourcepub fn add_cause(self, context: &str) -> CuError
pub fn add_cause(self, context: &str) -> CuError
Adds or replaces the cause with a context string.
This is useful for adding context to errors during propagation.
§Example
use cu29_traits::CuError;
let err = CuError::from("base error").add_cause("additional context");Sourcepub fn with_cause<E>(self, cause: E) -> CuError
pub fn with_cause<E>(self, cause: E) -> CuError
Adds a cause error to this CuError (builder pattern).
§Example
use cu29_traits::CuError;
let io_err = std::io::Error::other("io error");
let err = CuError::from("Operation failed").with_cause(io_err);Trait Implementations§
Source§impl<'de> Deserialize<'de> for CuError
impl<'de> Deserialize<'de> for CuError
Source§fn deserialize<D>(
deserializer: D,
) -> Result<CuError, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<CuError, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Error for CuError
Available on crate feature std only.
impl Error for CuError
std only.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()
Source§impl From<ConfigError> for CuError
impl From<ConfigError> for CuError
Source§fn from(err: ConfigError) -> CuError
fn from(err: ConfigError) -> CuError
Source§impl<S, L, A> From<LifecycleError<S, L, A>> for CuError
Allows ? in functions returning CuResult when the faulted application
does not need to be recovered.
impl<S, L, A> From<LifecycleError<S, L, A>> for CuError
Allows ? in functions returning CuResult when the faulted application
does not need to be recovered.
Source§fn from(value: LifecycleError<S, L, A>) -> CuError
fn from(value: LifecycleError<S, L, A>) -> CuError
Source§impl<S, L, A> From<SimLifecycleError<S, L, A>> for CuError
Available on crate feature std only.Allows ? in functions returning CuResult when the faulted application
does not need to be recovered.
impl<S, L, A> From<SimLifecycleError<S, L, A>> for CuError
std only.Allows ? in functions returning CuResult when the faulted application
does not need to be recovered.
Source§fn from(value: SimLifecycleError<S, L, A>) -> CuError
fn from(value: SimLifecycleError<S, L, A>) -> CuError
Source§impl Serialize for CuError
impl Serialize for CuError
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Auto Trait Implementations§
impl !RefUnwindSafe for CuError
impl !UnwindSafe for CuError
impl Freeze for CuError
impl Send for CuError
impl Sync for CuError
impl Unpin for CuError
impl UnsafeUnpin for CuError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PayloadDefaultHandlePolicyApply for Twhere
T: ?Sized,
impl<T> PayloadDefaultHandlePolicyApply for Twhere
T: ?Sized,
fn apply_handle_content_policy(&self, _mode: HandleContent)
Source§impl<T> PayloadDefaultLoggingPolicy for Twhere
T: ?Sized,
impl<T> PayloadDefaultLoggingPolicy for Twhere
T: ?Sized,
fn payload_should_log(&self) -> bool
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString]. Read more