#[derive(ApplicationError)]
{
// Attributes available to this derive:
#[stop_sentinel]
#[stop_sentinel_with_event]
#[database_error]
#[crates]
}
Expand description
Define a Application Error type that can be used in the event-driven-library.
Before deriving this, you must impl Debug
traits.
This macro can be only used in enum.
§Attributes
#[crates(...)]
- Specify the name of root of event-driven-library crate. (Default isevent_driven_library
)#[stop_sentinel]
- Specify the error matching forBaseError::StopSentinel
.#[stop_sentinel_with_event]
- Specify the error matching forBaseError::StopSentinelWithEvent
.#[database_error]
- Specify the error matching forBaseError::DatabaseError
.
§Example
ⓘ
#[derive(Debug, ApplicationError)]
#[crates(crate::imports::event_driven_library)]
enum TestError {
#[stop_sentinel]
Stop,
#[stop_sentinel_with_event]
StopWithEvent(Box<AnyError>),
#[database_error]
DatabaseError(Box<AnyError>),
}