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

clone() throws on props set to objects not prototypically extended from Object

Open jkantr opened this issue 7 years ago • 0 comments

Specifically wanted to use the return of querystring.parse() to save the response of an api call to a prop on my custom error. Took awhile to figure out that qs.parse() doesn't return a fully extended Object >.>

TypeError: target.hasOwnProperty is not a function at clone (...\node_modules\create-error\create-error.js:94:16) at attachProps (...\node_modules\create-error\create-error.js:82:26) at new ErrorCtor (...\node_modules\create-error\create-error.js:28:5)

Can we maybe just change create-error.js#L94 to if (Object.prototype.hasOwnProperty(target, attr)) ?

jkantr avatar May 09 '17 15:05 jkantr