1use std::fmt::Display;
2use std::io;
3
4use thiserror::Error;
5
6#[derive(Debug, Error)]
7pub struct SerDeError(#[from] pub(crate) postcard::Error);
9
10impl Display for SerDeError {
11 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12 write!(f, "Serialization/Deserialization error")
13 }
14}
15
16#[derive(Debug, Error)]
17pub enum IpcError {
18 #[error("Error in decoding or encoding: {0}.")]
19 SerializationError(#[from] SerDeError),
20 #[error("Error in IO: {0}.")]
21 Io(#[from] io::Error),
22 #[error("Ipc Disconnected.")]
26 Disconnected,
27}
28
29#[derive(Debug, Error)]
30pub enum TryRecvError {
31 #[error("IPC error {0}.")]
32 IpcError(#[from] IpcError),
33 #[error("Channel empty.")]
34 Empty,
35}
36
37#[derive(Debug, Error)]
39pub enum TrySelectError {
40 #[error("Error in IO: {0}.")]
41 IoError(#[from] io::Error),
42 #[error("No messages were received and no disconnections occurred.")]
43 Empty,
44}