pub enum RanvierError {
Message(String),
NotFound(String),
Validation(String),
Internal(String),
}Expand description
A serde-compatible error type for common Ranvier patterns.
This satisfies all Axon bounds (Serialize + DeserializeOwned + Send + Sync + Debug)
and provides typed variants for frequent error categories.
§When to Use
- Prototyping: When
Stringis too unstructured but a custom enum is overkill - Examples: As the standard error type in documentation examples
- Production: When error categories map cleanly to these variants
§Example
use ranvier_core::error::RanvierError;
let err = RanvierError::not_found("User 42");
assert_eq!(err.to_string(), "not found: User 42");Variants§
Message(String)
Generic message error
NotFound(String)
Resource not found
Validation(String)
Input validation failure
Internal(String)
Internal / unexpected error
Implementations§
Source§impl RanvierError
impl RanvierError
Sourcepub fn validation(msg: impl Into<String>) -> Self
pub fn validation(msg: impl Into<String>) -> Self
Create a validation error.
Trait Implementations§
Source§impl Clone for RanvierError
impl Clone for RanvierError
Source§fn clone(&self) -> RanvierError
fn clone(&self) -> RanvierError
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 RanvierError
impl Debug for RanvierError
Source§impl<'de> Deserialize<'de> for RanvierError
impl<'de> Deserialize<'de> for RanvierError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for RanvierError
impl Display for RanvierError
Source§impl Error for RanvierError
impl Error for RanvierError
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()
Source§impl From<&str> for RanvierError
impl From<&str> for RanvierError
Source§impl From<String> for RanvierError
impl From<String> for RanvierError
Source§impl PartialEq for RanvierError
impl PartialEq for RanvierError
Source§impl Serialize for RanvierError
impl Serialize for RanvierError
impl StructuralPartialEq for RanvierError
Auto Trait Implementations§
impl Freeze for RanvierError
impl RefUnwindSafe for RanvierError
impl Send for RanvierError
impl Sync for RanvierError
impl Unpin for RanvierError
impl UnsafeUnpin for RanvierError
impl UnwindSafe for RanvierError
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