serialised-error

WebJar for serialised-error

License

License

GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

serialised-error
Last Version

Last Version

1.1.3
Release Date

Release Date

Type

Type

jar
Description

Description

serialised-error
WebJar for serialised-error
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/postmanlabs/serialised-error

Download serialised-error

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/serialised-error/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>serialised-error</artifactId>
    <version>1.1.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/serialised-error/
implementation 'org.webjars.npm:serialised-error:1.1.3'
// https://jarcasting.com/artifacts/org.webjars.npm/serialised-error/
implementation ("org.webjars.npm:serialised-error:1.1.3")
'org.webjars.npm:serialised-error:jar:1.1.3'
<dependency org="org.webjars.npm" name="serialised-error" rev="1.1.3">
  <artifact name="serialised-error" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='serialised-error', version='1.1.3')
)
libraryDependencies += "org.webjars.npm" % "serialised-error" % "1.1.3"
[org.webjars.npm/serialised-error "1.1.3"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : object-hash jar [1.1.2,2)
org.webjars.npm : stack-trace jar [0.0.9]
org.webjars.npm : uuid jar [3.0.0,4)

Project Modules

There are no modules declared in this project.

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.

Property Description
checksum a SHA1 checksum of the error that is constant for same name, message and stack
id a random UUID (v4) of the error
timestamp the time when the error was serialised
timestampISO the time (in ISO format) when the error was serialised
stacktrace a prettified array of stack traces

Installation

npm install serialised-error;
org.webjars.npm

Postman Inc.

Versions

Version
1.1.3
1.1.2