1use thiserror::Error;
6
7use fidl_next_codec::{DecodeError, EncodeError};
8use fidl_next_protocol::ProtocolError;
9
10#[derive(Debug)]
12pub struct UnknownStrictEnumMemberError(i128);
13
14impl UnknownStrictEnumMemberError {
15 pub fn new(unknown_value: i128) -> Self {
17 Self(unknown_value)
18 }
19}
20
21impl core::fmt::Display for UnknownStrictEnumMemberError {
22 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
23 write!(f, "Strict enum doesn't have a member with value: {}", self.0)
24 }
25}
26
27impl core::error::Error for UnknownStrictEnumMemberError {}
28
29#[derive(Error, Clone, Debug)]
31pub enum Error<
32 #[cfg(feature = "fuchsia")] E = <zx::Channel as fidl_next_protocol::Transport>::Error,
33 #[cfg(not(feature = "fuchsia"))] E,
34> {
35 #[error("encoding error: {0}")]
37 Encode(#[from] EncodeError),
38 #[error("decoding error: {0}")]
40 Decode(#[from] DecodeError),
41 #[error("protocol error: {0}")]
43 Protocol(#[from] ProtocolError<E>),
44}