Separate super-deprecated errors from base errors, fix type override, and remove name override #672
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a follow-on to #661
It makes several small changes but the most consequential are:
get type()
support onStripeError
, so subclasses have the propertynew StripeFooClass({}).type === 'StripeFooClass'
, which is an important property to uphold. We missed this in Refactor errors to ES6 classes #661 because ourStripeError
tests had actually been testingGenericError
on accident, oops!.name
, which turned out not to be important for backcompat (previously.name
was just'Error'
) – was a mistake for me to ask for that.StripeError
inherit directly fromError
, and have the default export ofError.js
be an "old-school class" to maximize backcompat without any complexity leaking into our proper base class, and to emphasize that it is totally deprecated and will be going completely away. Users should not be relying on the stripe library to extend Error.r? @richardm-stripe
cc @stripe/api-libraries