Skip to content

`panic!` when headers are present, but have different ordering

With regard to #3, we should detect when orderings of columns with headers are different and panic!, so that the diff doesn't produce unexpected or rather wrong results.

This only takes effect when:

  • both CSVs have headers enabled
  • those headers differ in their ordering of columns

We know that panic!ing is not ideal, but we need to ship 0.1.0 asap.

We also should be able to release a fix for this as a patch release, because panicking and then not panicking (when the fix lands) is not a breaking change.

Alternatives

We could also introduce a safer way of handling this and not panic, but introduce an own error kind. However, we expect this to only be a temporary problem with csv-diff, so it is not worth it to break the api when we have a fix for this and need to remove the error kind again. Also it wouldn't be clear, where the error should originate from: currently, errors can only happen for the left and right CSV individually - there is no error kind yet that needs to look at both CSVs.