outbox_pattern_processor/
error.rs1use std::fmt;
2
3#[derive(Debug)]
4pub struct OutboxPatternProcessorError {
5 pub status_code: u16,
6 pub cause: String,
7 pub message: Option<String>,
8}
9
10impl OutboxPatternProcessorError {
11 pub fn new(
12 cause: &str,
13 message: &str,
14 ) -> Self {
15 Self {
16 status_code: 500,
17 cause: cause.to_string(),
18 message: Some(message.to_string()),
19 }
20 }
21}
22
23impl std::error::Error for OutboxPatternProcessorError {}
24
25impl fmt::Display for OutboxPatternProcessorError {
26 fn fmt(
27 &self,
28 f: &mut fmt::Formatter<'_>,
29 ) -> fmt::Result {
30 write!(f, "{}", self.cause)
31 }
32}