@@ -1,9 +1,10 @@
class ErrorV3 extends Error {
- constructor(message = '', code = '') {
+ constructor(message = '', code = '', stack = undefined) {
super(); // do not provide message to the super constructor
this.message = message;
this.code = code;
+ this.stack = stack;
}
@@ -22,6 +22,9 @@ const addCustomFunctionToResponse = (express, crowi) => {
if (e instanceof ErrorV3) {
return e;
+ if (e instanceof Error) {
+ return new ErrorV3(e.message, null, e.stack);
+ }
if (typeof e === 'string') {
return { message: e };