JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8890523
  • Score
    100M100P100Q208777F
  • License MIT

Serialize an error into a plain object

Package Exports

  • serialize-error

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (serialize-error) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

serialize-error Build Status

Serialize an error into a plain object

Useful if you for example need to JSON.stringify() 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