Fix FieldError constructor
This commit is contained in:
parent
bdf8c7206b
commit
4f6611f78d
1 changed files with 12 additions and 0 deletions
12
utils/fieldError.js
Normal file
12
utils/fieldError.js
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue