fix: update error handling in order lifecycle to check for missing time

This commit is contained in:
vchikalkin 2025-07-16 17:11:45 +03:00
parent bbb697b159
commit 07b4239038

View File

@ -1,5 +1,6 @@
import { extractId } from '../../../../utils'; import { extractId } from '../../../../utils';
const ERR_MISSING_TIME = 'Не указано время';
const ERR_INVALID_TIME = 'Некорректное время'; const ERR_INVALID_TIME = 'Некорректное время';
const ERR_OVERLAPPING_TIME = 'Время пересекается с другими заказами'; const ERR_OVERLAPPING_TIME = 'Время пересекается с другими заказами';
const ERR_INACTIVE_CLIENT = 'Клиент не активен'; const ERR_INACTIVE_CLIENT = 'Клиент не активен';
@ -29,7 +30,7 @@ export default {
// Проверка корректности времени заказа. // Проверка корректности времени заказа.
if (!time_start || !time_end) { if (!time_start || !time_end) {
throw new Error(ERR_INVALID_TIME); throw new Error(ERR_MISSING_TIME);
} }
if (timeToDate(time_start) >= timeToDate(time_end)) { if (timeToDate(time_start) >= timeToDate(time_end)) {
throw new Error(ERR_INVALID_TIME); throw new Error(ERR_INVALID_TIME);