Fix FieldError constructor

This commit is contained in:
emad-salah 2021-03-30 22:40:08 +01:00
parent bdf8c7206b
commit 4f6611f78d

12
utils/fieldError.js Normal file
View file

@ -0,0 +1,12 @@
class FieldError extends Error {
/** @param {any} error */
constructor(error) {
super();
this.message = (error && error.message) || "An unknown error has occurred";
this.field = (error && error.field) || "unknown";
this.name = (error && error.name);
this.stack = (error && error.stack);
}
}
module.exports = FieldError