Skip to content

Commit

Permalink
Merge pull request #341 from epage/fixes
Browse files Browse the repository at this point in the history
fix(data): Overwrite on 'is' error
  • Loading branch information
epage authored Jun 7, 2024
2 parents 4075137 + 3461854 commit c3b4651
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 c3b4651

Please sign in to comment.