merge-error-cause
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -6,14 +6,3 @@ import setErrorClass from"set-error-class"; | ||
export const mergeClass=function(parent,child,stackError){ | ||
const constructorError=shouldMergeClass(parent)?child:parent; | ||
const parentA=setErrorClass( | ||
parent, | ||
constructorError.constructor, | ||
stackError.name); | ||
fixName(parentA,constructorError); | ||
return parentA; | ||
}; | ||
const shouldMergeClass=function(parent){ | ||
export const getWrap=function(parent){ | ||
const{wrap,name}=parent; | ||
@@ -35,3 +24,12 @@ | ||
export const mergeClass=function({parent,child,stackError,wrap}){ | ||
const constructorError=wrap?child:parent; | ||
const parentA=setErrorClass( | ||
parent, | ||
constructorError.constructor, | ||
stackError.name); | ||
fixName(parentA,constructorError); | ||
return parentA; | ||
}; | ||
@@ -42,2 +40,4 @@ | ||
const fixName=function(parent,constructorError){ | ||
@@ -44,0 +44,0 @@ if(parent.name!==constructorError.name){ |
@@ -5,3 +5,3 @@ import normalizeException from"normalize-exception"; | ||
import{mergeAggregateCauses,mergeAggregateErrors}from"./aggregate.js"; | ||
import{mergeClass}from"./class.js"; | ||
import{getWrap,mergeClass}from"./class.js"; | ||
import{mergeMessage}from"./message.js"; | ||
@@ -41,2 +41,4 @@ import{getStack,hasStack,mergeStack}from"./stack.js"; | ||
const mergeCause=function(parent,recurse){ | ||
const wrap=getWrap(parent); | ||
if(parent.cause===undefined){ | ||
@@ -49,7 +51,7 @@ return{parent,childHasStack:false}; | ||
delete parent.cause; | ||
const parentA=mergeChild(parent,child,childHasStack); | ||
const parentA=mergeChild({parent,child,childHasStack,wrap}); | ||
return{parent:parentA,childHasStack}; | ||
}; | ||
const mergeChild=function(parent,child,childHasStack){ | ||
const mergeChild=function({parent,child,childHasStack,wrap}){ | ||
if(child===undefined){ | ||
@@ -60,3 +62,3 @@ return parent; | ||
const stackError=mergeStack(parent,child,childHasStack); | ||
const parentA=mergeClass(parent,child,stackError); | ||
const parentA=mergeClass({parent,child,stackError,wrap}); | ||
const parentB=mergeMessage(parentA,child,stackError); | ||
@@ -63,0 +65,0 @@ mergeAggregateErrors(parentB,child); |
{ | ||
"name": "merge-error-cause", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "exports": "./build/src/main.js", |
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
32040
197