Skip to content

Commit

Permalink
fix(data): Overwrite on 'is' error
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jun 7, 2024
1 parent 4075137 commit 3461854
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion crates/snapbox/src/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}
}

Expand Down

0 comments on commit 3461854

Please sign in to comment.