-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
It would be great if this library could pass the cause
property down to the underlying (sub-classed) built-in Error
constructor so that something like this works:
const cause = new Error("Something went wrong and this is the root cause");
throw new InternalServerError("An internal error occurred.", { cause });
In comparison if you write this code it will print the screenshot below (that's the expected behavior that would be great to get from this library as well):
const cause = new Error("Something went wrong and this is the root cause");
throw new Error("An internal error occurred.", { cause });
I believe all it needs is for the properties
to be passed in at this line in base.ts:
// Assign basic properties
super(message as string)
https://github.com/ShogunPanda/http-errors-enhanced/blob/main/src/base.ts#L41
Metadata
Metadata
Assignees
Labels
No labels