1#[doc(hidden)]
7extern crate alloc;
8
9#[cfg(feature = "std")]
10extern crate std;
11
12#[cfg(doc)]
14use super::enums::OperationState;
15use alloc::{boxed::Box, string::String};
16use thiserror::Error;
17pub type Result<T> = core::result::Result<T, Box<dyn core::error::Error + Send + Sync + 'static>>;
22#[derive(Error, Debug)]
27pub enum Error {
28 #[error("decoding failed: reason {source}")]
30 Decoding {
31 source: Box<dyn core::error::Error + Send + Sync>,
33 },
34 #[error("sending a reply failed: reason {source}")]
36 Reply {
37 source: Box<dyn core::error::Error + Send + Sync>,
39 },
40 #[error("query was empty")]
42 EmptyQuery,
43 #[error("no implementation available")]
45 NotImplemented,
46 #[error("the operation state {state} is unknown")]
48 UnknownOperationState {
49 state: String,
51 },
52}
53#[cfg(test)]
56mod tests {
57 use super::*;
58
59 const fn is_normal<T: Sized + Send + Sync>() {}
61
62 #[test]
63 const fn normal_types() {
64 is_normal::<Error>();
65 }
66}