intrepid_core/routing/path_error.rs
1/// These errors can occur when trying to deserialize frame messages.
2#[derive(Debug, thiserror::Error)]
3pub enum PathError {
4 /// Sometimes the frame isn't a message when we expect it to be.
5 #[error("Frame is not a message")]
6 FrameIsNotAMessage,
7 /// Sometimes the path extraction is attempted with the wrong kind of system.
8 #[error("Context is not a routing system")]
9 IncorrectActionContext,
10 /// Sometimes the path we've been given doesn't have any captures. This is an
11 /// error because we can't proceed and attempt to deserialize if so.
12 #[error("There were no captures for path: {0}")]
13 FailedToCapture(String),
14 /// Sometimes the path extraction fails to capture the given types. This can
15 /// happen for a number of reasons, the most likely being that the type we've
16 /// been given isn't a tuple and the consumer tried to extract a single type
17 /// that wasn't friendly with the fact that we need to deserialize lists.
18 #[error("Unable to capture given types from path: {0}")]
19 DeserializationFailure(#[from] serde_json::Error),
20}