pub struct FrameworkError {
pub severity: Severity,
pub source: ErrorSource,
pub message: String,
pub context: Option<String>,
}Expand description
Error from egui-cha framework internals
This type represents errors that occur within the framework itself, such as task panics, runtime failures, or subscription errors.
§Example
ⓘ
fn on_framework_error(model: &mut Model, err: FrameworkError) -> Cmd<Msg> {
// Add to your error console
model.errors.push_with_level(&err.message, err.severity.into());
// Or handle specific sources differently
match err.source {
ErrorSource::Command => { /* retry logic */ }
_ => { /* log and continue */ }
}
Cmd::none()
}Fields§
§severity: SeverityError severity
source: ErrorSourceError source/category
message: StringError message
context: Option<String>Optional context (additional details)
Implementations§
Source§impl FrameworkError
impl FrameworkError
Sourcepub fn new(
severity: Severity,
source: ErrorSource,
message: impl Into<String>,
) -> Self
pub fn new( severity: Severity, source: ErrorSource, message: impl Into<String>, ) -> Self
Create a new framework error
Sourcepub fn with_context(self, ctx: impl Into<String>) -> Self
pub fn with_context(self, ctx: impl Into<String>) -> Self
Add context to the error
Sourcepub fn subscription(severity: Severity, message: impl Into<String>) -> Self
pub fn subscription(severity: Severity, message: impl Into<String>) -> Self
Create a subscription error
Sourcepub fn format_message(&self) -> String
pub fn format_message(&self) -> String
Format the error message with source and context
Trait Implementations§
Source§impl Clone for FrameworkError
impl Clone for FrameworkError
Source§fn clone(&self) -> FrameworkError
fn clone(&self) -> FrameworkError
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 FrameworkError
impl Debug for FrameworkError
Source§impl Display for FrameworkError
impl Display for FrameworkError
Source§impl Error for FrameworkError
impl Error for FrameworkError
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()
Auto Trait Implementations§
impl Freeze for FrameworkError
impl RefUnwindSafe for FrameworkError
impl Send for FrameworkError
impl Sync for FrameworkError
impl Unpin for FrameworkError
impl UnsafeUnpin for FrameworkError
impl UnwindSafe for FrameworkError
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