From 3461854584e1a6a5a8469102d3b018f346101322 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 7 Jun 2024 15:25:41 -0500 Subject: [PATCH] fix(data): Overwrite on 'is' error --- crates/snapbox/src/data/mod.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/crates/snapbox/src/data/mod.rs b/crates/snapbox/src/data/mod.rs index feae56db..9522ce20 100644 --- a/crates/snapbox/src/data/mod.rs +++ b/crates/snapbox/src/data/mod.rs @@ -487,9 +487,21 @@ impl Data { /// /// This is generally used for `expected` data pub fn is(self, format: DataFormat) -> Self { + let filters = self.filters; + let source = self.source.clone(); match self.try_is(format) { Ok(new) => new, - Err(err) => Self::error(err, format), + Err(err) => { + let inner = DataInner::Error(DataError { + error: err, + intended: format, + }); + Self { + inner, + source, + filters, + } + } } }