Skip to content

Commit

Permalink
Classify TapeError as a syntax error (because some cases seem to thro…
Browse files Browse the repository at this point in the history
…w that)
  • Loading branch information
Martin Bartlett committed Oct 28, 2024
1 parent 7ff68bb commit 46f7407
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ impl Error {
#[must_use]
pub fn is_io(&self) -> bool {
// We have to include InternalError _somewhere_
matches!(self.error, ErrorType::Io(_) | ErrorType::InternalError(_))
match &self.error {
ErrorType::Io(_) => true,
ErrorType::InternalError(e) if !matches!(e, crate::InternalError::TapeError) => true,
_ => false
}
}

/// Indicates if the error that occurred was an early EOF
Expand All @@ -230,7 +234,8 @@ impl Error {
#[must_use]
pub fn is_syntax(&self) -> bool {
// Lazy? maybe but if it aint something else...
matches!(self.error,
matches!(self.error,
ErrorType::InternalError(crate::InternalError::TapeError) | //This seems to get thrown on some syntax errors
ErrorType::InputTooLarge |
ErrorType::BadKeyType |
ErrorType::ExpectedArrayComma |
Expand Down

0 comments on commit 46f7407

Please sign in to comment.