normalize-exception
Advanced tools
Comparing version 2.3.2 to 2.4.0
@@ -21,3 +21,3 @@ /** | ||
type NormalizedError<ErrorArg, OptionsArg extends Options> = Error & | ||
type NormalizedError<ErrorArg> = Error & | ||
(ErrorArg extends Error | ||
@@ -79,2 +79,2 @@ ? { | ||
options?: Options, | ||
): NormalizedError<ErrorArg, Options> | ||
): NormalizedError<ErrorArg> |
@@ -40,6 +40,16 @@ import{normalizeAggregate}from"./aggregate.js"; | ||
const normalizeName=function(error){ | ||
if(error.name!==error.constructor.name){ | ||
setErrorProperty(error,"name",error.constructor.name); | ||
if(isDefinedString(error.name)){ | ||
return; | ||
} | ||
const prototypeName=Object.getPrototypeOf(error).name; | ||
const name=isDefinedString(prototypeName)? | ||
prototypeName: | ||
error.constructor.name; | ||
setErrorProperty(error,"name",name); | ||
}; | ||
@@ -46,0 +56,0 @@ |
{ | ||
"name": "normalize-exception", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "exports": "./build/src/main.js", |
35244
433