You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Augustin AFFOGNON d626053dc1
Correction
2 years ago
..
index.js Correction 2 years ago
license Correction 2 years ago
package.json Correction 2 years ago
readme.md Correction 2 years ago

readme.md

serialize-error Build Status

Serialize an error into a plain object

Useful if you for example need to JSON.stringify() or process.send() the error.

Install

$ npm install --save serialize-error

Usage

const serializeError = require('serialize-error');
const error = new Error('unicorn');

console.log(error);
//=> [Error: unicorn]

console.log(serializeError(error));
//=> {name: 'Error', message: 'unicorn', stack: 'Error: unicorn\n    at Object.<anonymous> ...'}

License

MIT © Sindre Sorhus