pub enum FoundationError {
Config {
message: String,
},
Io(Error),
Serialization(Error),
Other(Error),
InvalidInput(String),
Parse(String),
Http(String),
UrlParse(String),
Authentication(String),
}Expand description
When enabled, primitive fields like boolean, string, integer, etc. will be generated as
macro calls such as primitive_boolean!("active", true) instead of regular struct fields.
These macros automatically generate both the primitive field and its companion extension field.
Foundation error type providing common error variants.
This enum covers the most common error cases across the workspace. Domain-specific crates can extend this by wrapping it in their own error types.
§Example
use rh_foundation::{FoundationError, ErrorContext};
fn example() -> rh_foundation::Result<()> {
std::fs::read_to_string("config.json")
.context("Failed to read config file")?;
Ok(())
}Variants§
Config
Configuration error with a descriptive message
Io(Error)
I/O error
Serialization(Error)
JSON serialization/deserialization error
Other(Error)
Generic error with context
InvalidInput(String)
Invalid input with descriptive message
Parse(String)
Parsing error
Http(String)
HTTP request error (available with http feature)
UrlParse(String)
URL parsing error
Authentication(String)
Authentication error
Implementations§
Source§impl FoundationError
impl FoundationError
Sourcepub fn with_context(self, context: &str) -> FoundationError
pub fn with_context(self, context: &str) -> FoundationError
Add context to this error
Trait Implementations§
Source§impl Debug for FoundationError
impl Debug for FoundationError
Source§impl Display for FoundationError
impl Display for FoundationError
Source§impl Error for FoundationError
impl Error for FoundationError
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<Error> for FoundationError
impl From<Error> for FoundationError
Source§fn from(source: Error) -> FoundationError
fn from(source: Error) -> FoundationError
Source§impl From<Error> for FoundationError
impl From<Error> for FoundationError
Source§fn from(source: Error) -> FoundationError
fn from(source: Error) -> FoundationError
Source§impl From<Error> for FoundationError
impl From<Error> for FoundationError
Source§fn from(source: Error) -> FoundationError
fn from(source: Error) -> FoundationError
Source§impl From<FoundationError> for CodegenError
impl From<FoundationError> for CodegenError
Source§fn from(source: FoundationError) -> Self
fn from(source: FoundationError) -> Self
Source§impl From<FoundationError> for LoaderError
impl From<FoundationError> for LoaderError
Source§fn from(source: FoundationError) -> LoaderError
fn from(source: FoundationError) -> LoaderError
Auto Trait Implementations§
impl Freeze for FoundationError
impl !RefUnwindSafe for FoundationError
impl Send for FoundationError
impl Sync for FoundationError
impl Unpin for FoundationError
impl UnsafeUnpin for FoundationError
impl !UnwindSafe for FoundationError
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.