Skip to content

fix: Declare error type as non_exhaustive#13

Merged
konstin merged 1 commit intomainfrom
konsti/non_exhaustive-error
Mar 31, 2026
Merged

fix: Declare error type as non_exhaustive#13
konstin merged 1 commit intomainfrom
konsti/non_exhaustive-error

Conversation

@konstin
Copy link
Copy Markdown
Member

@konstin konstin commented Mar 31, 2026

The semver checks flagged adding a new error variant as a breaking change. This is correct, but don't actually want to guarantee exhaustiveness, you should be able to check for specific error variants downstream to specialize the error message, but you shouldn't try to match exhaustively, the error representation isn't that stable. Other crates hide the error type altogether, but that's a bad experience as a user, I ran into problems with this before.

The semver checks flagged adding a new error variant as a breaking change. This is correct, but don't actually want to guarantee exhaustiveness, you should be able to check for specific error variants downstream to specialize the error message, but you shouldn't try to match exhaustively, the error representation isn't that stable. Other crates hide the error type altogether, but that's a bad experience as a user, I ran into problems with this before.
@konstin konstin changed the title Declare error type as non_exhaustive fix: Declare error type as non_exhaustive Mar 31, 2026
@konstin konstin merged commit 166aba4 into main Mar 31, 2026
4 of 5 checks passed
@konstin konstin deleted the konsti/non_exhaustive-error branch March 31, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant