diff --git a/src/parsers/error.rs b/src/parsers/error.rs index 9709816..77ba342 100644 --- a/src/parsers/error.rs +++ b/src/parsers/error.rs @@ -14,8 +14,8 @@ pub enum Error { #[error("R/W error: {0}")] Rw(#[from] rw::error::Error), - #[error("Unexpected byte parsing integer: {0}")] - UnexpectedByteParsingInteger(u8), + #[error("Unexpected byte parsing integer: {0}, char: {1}")] + UnexpectedByteParsingInteger(u8, char), #[error("Unrecognized first byte for new bencoded value: {0}, char: {1}")] UnrecognizedFirstBencodeValueByte(u8, char), diff --git a/src/parsers/integer.rs b/src/parsers/integer.rs index 28eef4b..d7590b1 100644 --- a/src/parsers/integer.rs +++ b/src/parsers/integer.rs @@ -53,7 +53,7 @@ pub fn parse( state = StateExpecting::DigitAfterSign; writer.write_byte(byte)?; } else { - return Err(Error::UnexpectedByteParsingInteger(byte)); + return Err(Error::UnexpectedByteParsingInteger(byte, byte as char)); } } }