Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

new-error

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

new-error - npm Package Compare versions

Comparing version 1.2.5 to 1.2.6

5

build/ErrorRegistry.d.ts

@@ -64,2 +64,7 @@ import { DeserializeOpts, HighLevelErrorInternal, IBaseError, IErrorRegistryConfig, LowLevelErrorInternal, SerializedError } from './interfaces';

/**
* Updates the stack trace to remove the error registry entry:
* "at ErrorRegistry.newError" and related entries
*/
private reformatTrace;
/**
* Deserializes data into an error

@@ -66,0 +71,0 @@ * @param {string} data JSON.parse()'d error object from

16

build/ErrorRegistry.js

@@ -74,5 +74,5 @@ "use strict";

const C = this.getClass(highLvErrName);
return new C(this.getHighLevelError(highLvErrName), {
return this.reformatTrace(new C(this.getHighLevelError(highLvErrName), {
message
}, this._config.baseErrorConfig);
}, this._config.baseErrorConfig));
}

@@ -90,5 +90,15 @@ /**

const C = this.getClass(highLvErrName);
return new C(this.getHighLevelError(highLvErrName), this.getLowLevelError(lowLvErrName), this._config.baseErrorConfig);
return this.reformatTrace(new C(this.getHighLevelError(highLvErrName), this.getLowLevelError(lowLvErrName), this._config.baseErrorConfig));
}
/**
* Updates the stack trace to remove the error registry entry:
* "at ErrorRegistry.newError" and related entries
*/
reformatTrace(err) {
const stack = err.stack.split('\n');
stack.splice(1, 1);
err.stack = stack.join('\n');
return err;
}
/**
* Deserializes data into an error

@@ -95,0 +105,0 @@ * @param {string} data JSON.parse()'d error object from

@@ -0,1 +1,9 @@

## 1.2.6 - Tue Mar 09 2021 00:23:04
**Contributor:** Theo Gravity
- Clean up stack traces
If you are calling `ErrorRegistry#newError` or related functions to create errors, the stack trace includes an `ErrorRegistry` entry. This change removes that entry for easier readability.
## 1.2.5 - Mon Mar 08 2021 22:54:45

@@ -2,0 +10,0 @@

2

package.json
{
"name": "new-error",
"version": "1.2.5",
"version": "1.2.6",
"description": "A production-grade error creation and serialization library designed for Typescript",

@@ -5,0 +5,0 @@ "main": "build/index.js",

Sorry, the diff of this file is not supported yet

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