Comparing version 1.2.5 to 1.2.6
@@ -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 |
@@ -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 @@ |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82590
1077