1use std::fmt;
2
3#[derive(Debug)]
5pub struct ConnClose {
6 pub code: u16,
8 pub reason: Box<str>,
10}
11
12impl fmt::Display for ConnClose {
13 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14 write!(f, "{}", self.reason)
15 }
16}
17
18impl std::error::Error for ConnClose {}
19
20#[derive(Debug)]
22pub enum NotifyError {
23 EventNameTooBig,
25 ReceiverClosed,
27}
28
29impl fmt::Display for NotifyError {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 match self {
32 NotifyError::EventNameTooBig => write!(f, "event name exceeds the allowed length."),
33 NotifyError::ReceiverClosed => write!(f, "receiver is already closed."),
34 }
35 }
36}
37
38impl std::error::Error for NotifyError {}
39
40
41#[derive(Debug)]
43pub struct ReceiverClosed;
44
45impl fmt::Display for ReceiverClosed {
46 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
47 write!(f, "receiver is already closed.")
48 }
49}
50impl std::error::Error for ReceiverClosed {}