Conversation
|
To clarify, are you saying that it's too strict because we'd be forced to verify that the error is an instance of Surely we're not intentionally throwing non-Errors. That's what I saw as the benefit of this rule - it's an additional check to ensure we're not throwing a non-Error. If handling |
Yes. It was causing a lot of errors in Snaps at least.
Good point. I wasn't aware of that option, that seems like a good alternative to completely disabling the rule. |
3f087a4 to
330e753
Compare
@typescript-eslint/prefer-promise-reject-errors rule@typescript-eslint/prefer-promise-reject-errors rule to allow rejecting with unknown
330e753 to
e692b25
Compare
…mise-reject-errors
This changes the
@typescript-eslint/prefer-promise-reject-errorsrule, which enforces thatPromise.rejectmust be called with an instance ofError. After this change,rejectmay also be called withunknownvalues. For example, the following code was previously invalid, but is valid after this change: