pub enum FoundationError {
InvalidHwpUnit {
value: i64,
min: i32,
max: i32,
},
InvalidColor {
component: String,
value: String,
},
IndexOutOfBounds {
index: usize,
max: usize,
type_name: &'static str,
},
EmptyIdentifier {
item: String,
},
InvalidField {
field: String,
reason: String,
},
ParseError {
type_name: String,
value: String,
valid_values: String,
},
}Expand description
The primary error type for the Foundation crate.
Returned by constructors and validators when input violates constraints. Every variant carries enough context to produce a meaningful diagnostic message.
§Examples
use hwpforge_foundation::FoundationError;
let err = FoundationError::InvalidHwpUnit {
value: 999_999_999,
min: -100_000_000,
max: 100_000_000,
};
assert!(err.to_string().contains("999999999"));Variants§
InvalidHwpUnit
An HwpUnit value was outside the valid range.
Fields
InvalidColor
A Color value or component was invalid.
Fields
IndexOutOfBounds
A branded index exceeded the collection bounds.
Fields
EmptyIdentifier
A string identifier was empty.
InvalidField
A generic field validation failure.
ParseError
A string could not be parsed into the target enum.
Trait Implementations§
Source§impl Clone for FoundationError
impl Clone for FoundationError
Source§fn clone(&self) -> FoundationError
fn clone(&self) -> FoundationError
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 FoundationError
impl Debug for FoundationError
Source§impl Display for FoundationError
impl Display for FoundationError
Source§impl Error for FoundationError
impl Error for FoundationError
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 ErrorCodeExt for FoundationError
impl ErrorCodeExt for FoundationError
Auto Trait Implementations§
impl Freeze for FoundationError
impl RefUnwindSafe for FoundationError
impl Send for FoundationError
impl Sync for FoundationError
impl Unpin 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
Mutably borrows from an owned value. Read more