Fix GetPassword errors processing.

GitOrigin-RevId: 5ebddd0d2ad1630eb8a4c2081d9bc724c72ff307
This commit is contained in:
levlam 2019-12-18 04:08:34 +03:00
parent 4ce3005081
commit 3acb445d1c
2 changed files with 13 additions and 2 deletions

View File

@ -542,7 +542,12 @@ void AuthManager::on_get_login_token(tl_object_ptr<telegram_api::auth_LoginToken
}
void AuthManager::on_get_password_result(NetQueryPtr &result) {
auto r_password = fetch_result<telegram_api::account_getPassword>(result->ok());
Result<telegram_api::object_ptr<telegram_api::account_password>> r_password;
if (result->is_error()) {
r_password = std::move(result->error());
} else {
r_password = fetch_result<telegram_api::account_getPassword>(result->ok());
}
if (r_password.is_error() && query_id_ != 0) {
return on_query_error(r_password.move_as_error());
}
@ -796,7 +801,9 @@ void AuthManager::on_result(NetQueryPtr result) {
on_query_error(std::move(result->error()));
return;
}
if (type != NetQueryType::RequestQrCode && type != NetQueryType::ImportQrCode) {
if (type != NetQueryType::RequestQrCode && type != NetQueryType::ImportQrCode &&
type != NetQueryType::GetPassword) {
LOG(INFO) << "Ignore error for net query of type " << static_cast<int32>(net_query_type_);
return;
}
}

View File

@ -51,6 +51,10 @@ void NetQueryDispatcher::dispatch(NetQueryPtr net_query) {
net_query->set_error(Status::Error(429, "Too Many Requests: retry after 10"));
return complete_net_query(std::move(net_query));
}
if (net_query->tl_constructor() == telegram_api::account_getPassword::ID && false) {
net_query->set_error(Status::Error(429, "Too Many Requests: retry after 10"));
return complete_net_query(std::move(net_query));
}
if (net_query->is_ready()) {
if (net_query->is_error()) {