add error handler

This commit is contained in:
smanylov
2026-01-30 23:02:18 +07:00
parent c5baec6d1d
commit b4249c7f38
3 changed files with 19 additions and 12 deletions
+15 -10
View File
@@ -259,16 +259,21 @@ export async function registration(
break;
case 2:
typedError.message_body.fieldErrors.forEach((obj: {
code: string,
field: string
}) => {
if (errors[obj.field]) {
errors[obj.field] = `${errors[obj.field]}&${obj.code.replaceAll('.', '-')}`;
} else {
errors[obj.field] = obj.code.replaceAll('.', '-');
}
});
if (typedError.message_body?.fieldErrors) {
typedError.message_body?.fieldErrors?.forEach((obj: {
code: string,
field: string
}) => {
if (errors[obj.field]) {
errors[obj.field] = `${errors[obj.field]}&${obj.code.replaceAll('.', '-')}`;
} else {
errors[obj.field] = obj.code.replaceAll('.', '-');
}
});
} else {
errors['server'] = 'unknown-error'
}
break;
default:
+2 -1
View File
@@ -274,6 +274,7 @@
"register-error-password-not-allowed-symbols": "Password contains invalid characters.",
"confirmation-code": "Confirmation code",
"enter-confirmation-code": "Enter the confirmation code",
"personal": "Personal"
"personal": "Personal",
"unknown-error": "Unknown error"
}
}
+2 -1
View File
@@ -274,6 +274,7 @@
"register-error-password-not-allowed-symbols": "Пароль содержит недопустимые символы.",
"confirmation-code": "Код подтверждения",
"enter-confirmation-code": "Введите код подтверждения",
"personal": "Личный"
"personal": "Личный",
"unknown-error": "Неизвестная ошибка"
}
}