normalize-exception
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -36,3 +36,3 @@ import{normalizeAggregate}from"./aggregate.js"; | ||
const normalizeName=function(error){ | ||
if(!isDefinedString(error.name)){ | ||
if(error.name!==error.constructor.name){ | ||
setErrorProperty(error,"name",error.constructor.name); | ||
@@ -39,0 +39,0 @@ } |
{ | ||
"name": "normalize-exception", | ||
"version": "1.7.0", | ||
"version": "1.8.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "exports": "./build/src/main.js", |
@@ -120,2 +120,17 @@ [![Codecov](https://img.shields.io/codecov/c/github/ehmicky/normalize-exception.svg?label=tested&logo=codecov)](https://codecov.io/gh/ehmicky/normalize-exception) | ||
## Mismatched name | ||
<!-- eslint-disable fp/no-delete --> | ||
```js | ||
try { | ||
const error = new TypeError('message') | ||
error.name = 'RangeError' | ||
throw error | ||
} catch (error) { | ||
console.log(error.name) // 'RangeError' | ||
console.log(normalizeException(error).name) // 'TypeError' | ||
} | ||
``` | ||
## Missing stack | ||
@@ -122,0 +137,0 @@ |
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
34399
378