1 | //! Error types. |
---|---|
2 | |
3 | use std::ops::Range; |
4 | |
5 | #[derive(Debug, thiserror::Error)] |
6 | pub enum Error { |
7 | #[error("invalid range {0:?}, start is larger than end")] |
8 | InvalidRange(Range<usize>), |
9 | |
10 | #[error("invalid range {0:?}, original data is only {1} byte long")] |
11 | DataLengthExceeded(Range<usize>, usize), |
12 | |
13 | #[error("could not replace range {0:?}, maybe parts of it were already replaced?")] |
14 | MaybeAlreadyReplaced(Range<usize>), |
15 | |
16 | #[error("cannot replace slice of data that was already replaced")] |
17 | AlreadyReplaced, |
18 | |
19 | #[error(transparent)] |
20 | Utf8(#[from] std::string::FromUtf8Error), |
21 | } |
22 |