From 9618b5e8e9f3811d17fe533ea60755174e1a8c53 Mon Sep 17 00:00:00 2001 From: Dmytro Panontko Date: Tue, 2 Jul 2019 11:30:03 +0300 Subject: [PATCH] Improve error handling --- server/utils/error.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/utils/error.js b/server/utils/error.js index 1c99736..d7920ed 100644 --- a/server/utils/error.js +++ b/server/utils/error.js @@ -10,6 +10,7 @@ const defaultError = { value: '', message: 'Something went wrong.', userMessage: 'Something went wrong.', + httpCode: 500, }; class CustomError extends Error { @@ -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 = {};