1use thiserror::Error;
4
5use std::num::ParseIntError;
6
7#[derive(Clone, Debug, Error)]
9#[non_exhaustive]
10pub enum Error {
11 #[error("Invalid diff: {0}")]
15 BadDiff(&'static str),
16
17 #[error("Diff didn't apply to input: {0}")]
20 CantApply(&'static str),
21}
22
23impl From<ParseIntError> for Error {
24 fn from(_e: ParseIntError) -> Error {
25 Error::BadDiff("can't parse line number")
26 }
27}
28impl From<hex::FromHexError> for Error {
29 fn from(_e: hex::FromHexError) -> Error {
30 Error::BadDiff("invalid hexadecimal in 'hash' line")
31 }
32}