rusmpp_extra/encoding/latin1/
errors.rs1use crate::concatenation::MAX_PARTS;
2
3#[derive(Debug, thiserror::Error, PartialEq, Eq)]
6pub enum Latin1EncodeError {
7 #[error("Input contains un-encodable character")]
9 UnencodableCharacter,
10}
11
12#[derive(Debug, thiserror::Error, PartialEq, Eq)]
14pub enum Latin1ConcatenateError {
15 #[error("Encoding error: {0}")]
17 Encode(
18 #[from]
19 #[source]
20 Latin1EncodeError,
21 ),
22 #[error(
26 "Cannot fit even a single character into a part with the given header and size constraints"
27 )]
28 PartCapacityExceeded,
29 #[error("The number of parts exceeds the maximum allowed. actual: {actual}, max: {max}")]
30 PartsCountExceeded {
32 max: usize,
34 actual: usize,
36 },
37}
38
39impl Latin1ConcatenateError {
40 pub(crate) const fn parts_count_exceeded(actual: usize) -> Self {
41 Self::PartsCountExceeded {
42 max: MAX_PARTS,
43 actual,
44 }
45 }
46}