dbus_message_parser/encode/
error.rs

1use crate::value::{Type, TypeError, MAXIMUM_ARRAY_LENGTH};
2use thiserror::Error;
3
4pub type EncodeResult<T> = Result<T, EncodeError>;
5
6/// An enum representing all errors, which can occur during the encoding.
7#[derive(Debug, PartialEq, Error)]
8pub enum EncodeError {
9    #[error("Array length is too big: {MAXIMUM_ARRAY_LENGTH} < {0}")]
10    ArrayTooBig(usize),
11    #[error("The body length is zero, but there is a body signature '{0:?}'")]
12    BodyLengthZero(Vec<Type>),
13    #[error("The body signature is missing, but there body length 0 != {0}")]
14    BodySignatureMissing(u32),
15    #[error("Could not encode Signature: {0}")]
16    SignatureError(#[from] TypeError),
17}