create-error icon indicating copy to clipboard operation
create-error copied to clipboard

Why clone props?

Open matthewwithanm opened this issue 11 years ago • 0 comments

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.

matthewwithanm avatar Sep 30 '14 01:09 matthewwithanm