Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmytro Panontko committed Jul 2, 2019
1 parent af21a8c commit 0579694
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/utils/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const defaultError = {
value: '',
message: 'Something went wrong.',
userMessage: 'Something went wrong.',
httpCode: 500,
};

class CustomError extends Error {
Expand All @@ -32,7 +33,7 @@ class CustomError extends Error {
constructor(errorCode, httpCode, ...params) {
super(params);
this.errors = [CustomError.createError(errorCode)];
this.code = httpCode || this.errors[0].code;
this.code = httpCode || this.errors[0].httpCode;
this.message = this.errors[0].message;
this.name = 'Server error';
this.request = {};
Expand Down

0 comments on commit 0579694

Please sign in to comment.