create-error
create-error copied to clipboard
Why clone props?
create-error has a pretty naive cloning implementation that seems to prevent you from storing any real objects on the error. For example:
var MyCustomError = createError('MyCustomError');
new MyCustomError('Bad!', {xhr: xhr});
Assuming that xhr is an instance of XMLHttpRequest, you're actually going to get a new one on your error instance.
I guess this functionality was intended to allow you to add arbitrary simple but nested objects without fear of them being mutated, but it seems very limiting IMO.