mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-10 03:51:25 +00:00
fix error types
This commit is contained in:
1 parent
7e8ca70153
commit
a4e3525080
2 files changed
+4
-8
No files matched your search
@@ -71,7 +71,7 @@ impl Pager {
|
||||
notification: NotificationDetails,
|
||||
) -> Result<(), PagerError> {
|
||||
let queue = self.queue.as_ref()
|
||||
.ok_or(PagerSystemError::QueueFull)?;
|
||||
.ok_or(PagerSystemError::QueueNotConfigured)?;
|
||||
|
||||
let dropped = queue.push(notification)?;
|
||||
|
||||
|
||||
@@ -7,11 +7,8 @@ pub enum PagerSystemError {
|
||||
/// The pager was not configured with a backend.
|
||||
NoBackendConfigured,
|
||||
|
||||
/// The pager was not configured with an application name.
|
||||
NoApplicationName,
|
||||
|
||||
/// The message queue is full and the oldest item was dropped.
|
||||
QueueFull,
|
||||
/// The message queue was not configured. Use `build_with_worker()` to enable queuing.
|
||||
QueueNotConfigured,
|
||||
|
||||
/// A mutex lock was poisoned (another thread panicked while holding it).
|
||||
MutexPoisoned(String),
|
||||
@@ -23,8 +20,7 @@ impl Display for PagerSystemError {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::NoBackendConfigured => write!(f, "No pager backend configured. Call .rootly() or .client_config() on PagerBuilder."),
|
||||
Self::NoApplicationName => write!(f, "No application name configured. Call .application_name() on PagerBuilder."),
|
||||
Self::QueueFull => write!(f, "Pager message queue is full."),
|
||||
Self::QueueNotConfigured => write!(f, "Pager message queue not configured. Use build_with_worker() to enable queuing."),
|
||||
Self::MutexPoisoned(msg) => write!(f, "Pager mutex poisoned: {}", msg),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user