1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use thiserror::Error;

// Convenience type alias for usage within event_store.
type BoxDynError = Box<dyn std::error::Error + 'static + Send + Sync>;

#[derive(Error, Debug)]
pub enum EventBusError {
    #[error("Notification error: {0}")]
    EventNotificationError(EventNotificationError),
    #[error("Internal storage error: {0}")]
    InternalEventBusError(#[source] BoxDynError),
}

#[derive(Error, Debug)]
pub enum EventNotificationError {
    #[error("Unable to parse {field}")]
    ParsingError { field: &'static str },
    #[error("Invalid stream_uuid")]
    InvalidStreamUUID,
}