Skip to content

Commit

Permalink
feat: add char to error
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Oct 8, 2024
1 parent b4fba9f commit 8c67f41
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/parsers/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub fn parse<R: Read, W: Writer>(
state = StateExpecting::DigitAfterSign;
writer.write_byte(byte)?;
} else {
return Err(Error::UnexpectedByteParsingInteger(byte));
return Err(Error::UnexpectedByteParsingInteger(byte, byte as char));
}
}
}

0 comments on commit 8c67f41

Please sign in to comment.