pub enum ZakatError {
CalculationError(Box<ErrorDetails>),
InvalidInput(Box<InvalidInputDetails>),
ConfigurationError(Box<ErrorDetails>),
Overflow {
operation: String,
source_label: Option<String>,
asset_id: Option<Uuid>,
},
MissingConfig {
field: String,
source_label: Option<String>,
asset_id: Option<Uuid>,
},
MultipleErrors(Vec<ZakatError>),
NetworkError(String),
}Variants§
CalculationError(Box<ErrorDetails>)
InvalidInput(Box<InvalidInputDetails>)
ConfigurationError(Box<ErrorDetails>)
Overflow
MissingConfig
MultipleErrors(Vec<ZakatError>)
NetworkError(String)
Implementations§
Source§impl ZakatError
impl ZakatError
Sourcepub fn error_code(&self) -> ZakatErrorCode
pub fn error_code(&self) -> ZakatErrorCode
Returns the structured error code enum for programmatic handling.
This is preferred over code() for new code as it provides type safety
and enables exhaustive pattern matching.
§Example
ⓘ
match err.error_code() {
ZakatErrorCode::InvalidInput => handle_validation(),
ZakatErrorCode::BelowNisab => show_exempt_message(),
_ => handle_generic(),
}Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
Returns a standardized error code string for FFI consumers.
Deprecated: Use error_code() for new code to get the typed enum.
These codes are used by all FFI bindings (Python, Dart, WASM) to programmatically identify error types without parsing error messages.
pub fn with_source(self, source: String) -> ZakatError
Sourcepub fn with_asset_id(self, id: Uuid) -> ZakatError
pub fn with_asset_id(self, id: Uuid) -> ZakatError
Sets the asset ID for debugging purposes.
Sourcepub fn report(&self) -> String
pub fn report(&self) -> String
Reports the error as a user-friendly message (basic, non-localized).
For localized output, use zakat-i18n crate.
Sourcepub fn report_default(&self) -> String
pub fn report_default(&self) -> String
Generates a user-friendly error report.
Trait Implementations§
Source§impl Clone for ZakatError
impl Clone for ZakatError
Source§fn clone(&self) -> ZakatError
fn clone(&self) -> ZakatError
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 ZakatError
impl Debug for ZakatError
Source§impl<'de> Deserialize<'de> for ZakatError
impl<'de> Deserialize<'de> for ZakatError
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ZakatError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ZakatError, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ZakatError
impl Display for ZakatError
Source§impl Error for ZakatError
impl Error for ZakatError
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<ZakatError> for FfiZakatError
impl From<ZakatError> for FfiZakatError
Source§fn from(err: ZakatError) -> FfiZakatError
fn from(err: ZakatError) -> FfiZakatError
Converts to this type from the input type.
Source§impl PartialEq for ZakatError
impl PartialEq for ZakatError
Source§impl Serialize for ZakatError
impl Serialize for ZakatError
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,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ZakatError
Auto Trait Implementations§
impl Freeze for ZakatError
impl RefUnwindSafe for ZakatError
impl Send for ZakatError
impl Sync for ZakatError
impl Unpin for ZakatError
impl UnwindSafe for ZakatError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>
Converts
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>
Converts
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> 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.