Trait ErrorHook
pub trait ErrorHook: Send + Sync {
// Required methods
fn throw(&self, error: Error) -> ErrorId;
fn clear(&self, id: &ErrorId);
}
Expand description
Implements behavior that allows for global or scoped error handling.
This allows for both “throwing” errors to register them, and “clearing” errors when they are no longer valid. This is useful for something like a user interface, in which an error can be “thrown” on some invalid user input, and later “cleared” if the user corrects the input. Keeping a unique identifier for each error allows the UI to be updated accordingly.