Skip to content

feat: throw custom ExhaustiveError when no matched pattern#270

Merged
gvergnaud merged 1 commit intogvergnaud:mainfrom
adamhamlin:feat/custom-exhaustive-error
Jul 24, 2024
Merged

feat: throw custom ExhaustiveError when no matched pattern#270
gvergnaud merged 1 commit intogvergnaud:mainfrom
adamhamlin:feat/custom-exhaustive-error

Conversation

@adamhamlin
Copy link
Contributor

This adds/exports a custom ExhaustiveError which will be thrown at runtime when a match input doesn't match any pattern and .exhaustive() has been specified. This gives better error handling capabilities, for example when trying to distinguish between an unmatched pattern error and an error thrown within a matched pattern's callback.

Resolves #269

@adamhamlin adamhamlin marked this pull request as ready for review July 24, 2024 03:02
Copy link
Owner

@gvergnaud gvergnaud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

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.

Throw explicit ExhaustiveError

2 participants