Skip to content

Commit

Permalink
fix: newFromError constructorOpt
Browse files Browse the repository at this point in the history
  • Loading branch information
skarab42 committed Apr 9, 2022
1 parent a8753e3 commit b17b68f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ export function factory<TErrorTypes extends PojoErrorTypes>(
const func = errors[type] as TErrorTypes[TType];
const data = func(...args) as ReturnType<TErrorTypes[TType]>;

return new PojoError(type, args, data, { cause, constructorOpt: newError });
return new PojoError(type, args, data, {
cause,
constructorOpt: newFromError,
});
}

function throwError<TType extends keyof TErrorTypes>(
Expand Down

0 comments on commit b17b68f

Please sign in to comment.