value-error
v1.0.0
Published
Extract the data from an Error to a plain object
Downloads
6
Maintainers
Readme
value-error
Extract the data from an Error to a plain object
Install
$ npm install --save value-error
Usage
var valueError = require('value-error')
var err = new Error('OH NO')
err.data = {foo: 'bar'}
valueError(err)
//=> {message: 'OH NO', data: {foo: 'bar'}}
API
valueError(err)
-> object
err
Required
Type: error
An Error
instance to be copied into a plain object. All enumerable properties will be copied. The message
will be copied even if it is non-enumerable. Other non-enumerable/inherited properties like stack
and name
will not be included.
License
MIT © Ben Drucker