add error 422 to reg

This commit is contained in:
cheykrym 2025-10-24 21:49:32 +03:00
parent 3c394446d2
commit 052ff5fe4f
2 changed files with 17 additions and 1 deletions

View File

@ -229,11 +229,24 @@ final class AuthService {
return mappedRegistrationMessage(for: message, statusCode: statusCode) return mappedRegistrationMessage(for: message, statusCode: statusCode)
} }
let message = extractMessage(from: data)
switch statusCode { switch statusCode {
case 400: case 400:
return NSLocalizedString("Неверный запрос (400).", comment: "") return NSLocalizedString("Неверный запрос (400).", comment: "")
case 403: case 403:
return NSLocalizedString("Регистрация запрещена.", comment: "") return NSLocalizedString("Регистрация запрещена.", comment: "")
case 409:
return NSLocalizedString("Логин уже занят.", comment: "")
case 422:
if let message {
if message == "Value error, Login must not end with 'bot' for non-bot accounts"{
return NSLocalizedString("Login must not end with 'bot' for non-bot accounts", comment: "")
}
return message
} else {
return NSLocalizedString("Ошибка в данных. Проверьте введённую информацию.", comment: "")
}
case 429: case 429:
return NSLocalizedString("Слишком много запросов.", comment: "") return NSLocalizedString("Слишком много запросов.", comment: "")
case 502: case 502:

View File

@ -1535,6 +1535,9 @@
} }
} }
} }
},
"Ошибка в данных. Проверьте введённую информацию." : {
}, },
"Ошибка при деавторизации." : { "Ошибка при деавторизации." : {
"localizations" : { "localizations" : {