diff --git a/service/controllers/clients.js b/service/controllers/clients.js index 0f06da4..acd2dd9 100644 --- a/service/controllers/clients.js +++ b/service/controllers/clients.js @@ -27,6 +27,7 @@ import { couponNotFound, clientLimitReached, couponsLimitReached, + errorOccured, } from "#utils/errors"; import { deleteCacheItem } from "#utils/cache"; @@ -76,7 +77,7 @@ export const updateClientData = async ({ }) .then((res) => { if (res.rowCount > 0) { - throw emailUsed(language); + throw errorOccured(language); } }) .catch((err) => { diff --git a/service/translations/en.js b/service/translations/en.js index 4cf7ae8..8d4b16d 100644 --- a/service/translations/en.js +++ b/service/translations/en.js @@ -12,4 +12,5 @@ export default { coupons_limit_reached_error: "The maximum amount of consultations covered by this campaign has been reached", consultation_not_found_error: "Consultation not found", + error_occured: "An error occurred", }; diff --git a/service/translations/kk.js b/service/translations/kk.js index da626ed..37b0014 100644 --- a/service/translations/kk.js +++ b/service/translations/kk.js @@ -12,4 +12,5 @@ export default { coupons_limit_reached_error: "Осы науқанда қамтылған кеңестердің максималды санына жетті", consultation_not_found_error: "Консультация табылмады", + en_error_occured: "Қателік пайда болды", }; diff --git a/service/translations/ru.js b/service/translations/ru.js index 475bf69..5a2b7c8 100644 --- a/service/translations/ru.js +++ b/service/translations/ru.js @@ -13,4 +13,5 @@ export default { coupons_limit_reached_error: "Достигнуто максимальное количество консультаций, охваченных этой кампанией", consultation_not_found_error: "Консультация не найдена", + an_error_occured: "Произошла ошибка", }; diff --git a/service/utils/errors.js b/service/utils/errors.js index 9a349ee..312f642 100644 --- a/service/utils/errors.js +++ b/service/utils/errors.js @@ -63,3 +63,11 @@ export const consultationNotFound = (language) => { error.status = 404; return error; }; + +export const errorOccured = (language) => { + const error = new Error(); + error.message = t("error_occured", language); + error.name = "ERROR OCCURED"; + error.status = 404; + return error; +};