From 46f74071e9b12884170ae18d3701f475df696df3 Mon Sep 17 00:00:00 2001 From: Martin Bartlett Date: Mon, 28 Oct 2024 09:52:50 +0100 Subject: [PATCH] Classify TapeError as a syntax error (because some cases seem to throw that) --- src/error.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/error.rs b/src/error.rs index 8e0be4bb..24b9cff7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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 @@ -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 |