New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

serialised-error

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serialised-error

Serialises error object to normal object

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
106K
decreased by-79.89%
Maintainers
3
Weekly downloads
 
Created
Source

Serialised Error

This module attempts to convert an error object into a regular JavaScript object. This is useful if an error object has to be stored and operated upon.

Usage

var SerialisedError = require('serialised-error');

// assuming you have an error
var someError = new Error("This is a test error");

// convert the error to object (new operator is optional)
var serialisedError = new SerialisedError(someError);

// convert the serialised error to JSON
console.log(JSON.parse(serialisedError));

// this outputs:
// {"name": "Error", "message": "This is a test error", "stack": "Error\n   at ..."}

Adding additional meta information to error

Passing a second argument as true to the SerialisedError constructor adds the following keys to the serialised object.

PropertyDescription
checksuma SHA1 checksum of the error that is constant for same name, message and stack
ida random UUID (v4) of the error
timestampthe time when the error was serialised
timestampISOthe time (in ISO format) when the error was serialised
stacktracea prettified array of stack traces

Installation

npm install serialised-error;

Keywords

FAQs

Package last updated on 07 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc