binary_modifier/error.rs
1use thiserror::Error;
2
3/// Error generated reading and writing binary data.
4#[derive(Debug, Error)]
5pub enum BinaryError {
6 /// Error generated attempted to read past the end of file.
7 #[error("attempt to read past EOF")]
8 ReadPastEof,
9 /// Error generated trying to read the char type.
10 #[error("invalid character read from stream")]
11 InvalidChar,
12 /// Error generated converting between integers.
13 #[error(transparent)]
14 TryFromInt(#[from] std::num::TryFromIntError),
15 /// Error generated converting to UTF-8.
16 #[error(transparent)]
17 Utf8Error(#[from] std::string::FromUtf8Error),
18 /// Error generated by input / output.
19 #[error(transparent)]
20 Io(#[from] std::io::Error),
21}