The type property on error objects was set to this.constructor.name, which gets mutated during minification. To fix this, explicitly set the type to a hardcoded string for known subclasses of StripeError. This also keeps the default behavior the same in the StripeError parent class for backwards compatibility.
I've added a test project to verify error.type does not get minified when bundling / minifying with esbuild.
The
type
property on error objects was set tothis.constructor.name
, which gets mutated during minification. To fix this, explicitly set thetype
to a hardcoded string for known subclasses ofStripeError
. This also keeps the default behavior the same in theStripeError
parent class for backwards compatibility.I've added a test project to verify
error.type
does not get minified when bundling / minifying with esbuild.Fixes https://github.com/stripe/stripe-node/issues/2042