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

merge-error-cause

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merge-error-cause - npm Package Compare versions

Comparing version 2.5.0 to 2.5.1

24

build/src/class.js

@@ -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",

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