Skip to content

Commit

Permalink
Implement reader error translation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbabcock committed Dec 21, 2023
1 parent ffe8813 commit 8c14c88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl BufferWindow {
// No buffer means we are reading from a slice and there is nothing more
// to fill
if self.buf.len() == 0 {
return Ok(0)
return Ok(0);
}

// Copy over the unconsumed bytes to the start of the buffer
Expand Down
4 changes: 2 additions & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl From<BinReaderError> for Error {
let pos = value.position();
match value.into_kind() {
crate::binary::ReaderErrorKind::Read(x) => Error::new(ErrorKind::Io(x)),
crate::binary::ReaderErrorKind::BufferFull => todo!(),
crate::binary::ReaderErrorKind::BufferFull => Error::new(ErrorKind::BufferFull),
crate::binary::ReaderErrorKind::Lexer(LexError::Eof) => Error::eof(),
crate::binary::ReaderErrorKind::Lexer(LexError::InvalidRgb) => {
Error::invalid_syntax("invalid rgb", pos)
Expand All @@ -165,7 +165,7 @@ impl From<TextReaderError> for Error {
fn from(value: TextReaderError) -> Self {
match value.into_kind() {
crate::text::ReaderErrorKind::Read(x) => Error::new(ErrorKind::Io(x)),
crate::text::ReaderErrorKind::BufferFull => todo!(),
crate::text::ReaderErrorKind::BufferFull => Error::new(ErrorKind::BufferFull),
crate::text::ReaderErrorKind::Eof => Error::eof(),
}
}
Expand Down

0 comments on commit 8c14c88

Please sign in to comment.