Skip to content

Commit

Permalink
Refactor: don't indicate if an email is used or not when updating cli…
Browse files Browse the repository at this point in the history
…ent data
  • Loading branch information
georgipavlov-7DIGIT committed Feb 27, 2024
1 parent 1bd199c commit e076fcd
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion service/controllers/clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
couponNotFound,
clientLimitReached,
couponsLimitReached,
errorOccured,
} from "#utils/errors";
import { deleteCacheItem } from "#utils/cache";

Expand Down Expand Up @@ -76,7 +77,7 @@ export const updateClientData = async ({
})
.then((res) => {
if (res.rowCount > 0) {
throw emailUsed(language);
throw errorOccured(language);
}
})
.catch((err) => {
Expand Down
1 change: 1 addition & 0 deletions service/translations/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
};
1 change: 1 addition & 0 deletions service/translations/kk.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ export default {
coupons_limit_reached_error:
"Осы науқанда қамтылған кеңестердің максималды санына жетті",
consultation_not_found_error: "Консультация табылмады",
en_error_occured: "Қателік пайда болды",
};
1 change: 1 addition & 0 deletions service/translations/ru.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export default {
coupons_limit_reached_error:
"Достигнуто максимальное количество консультаций, охваченных этой кампанией",
consultation_not_found_error: "Консультация не найдена",
an_error_occured: "Произошла ошибка",
};
8 changes: 8 additions & 0 deletions service/utils/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

0 comments on commit e076fcd

Please sign in to comment.