Add specific error for failed translation.

This commit is contained in:
levlam 2024-06-07 12:26:39 +03:00
parent f2d2a94ae3
commit a1e41ac1d4

View File

@ -122,6 +122,9 @@ void TranslationManager::on_get_translated_texts(vector<telegram_api::object_ptr
Promise<td_api::object_ptr<td_api::formattedText>> &&promise) {
TRY_STATUS_PROMISE(promise, G()->close_status());
if (texts.size() != 1u) {
if (texts.empty()) {
return promise.set_error(Status::Error(500, "Translation failed"));
}
return promise.set_error(Status::Error(500, "Receive invalid number of results"));
}
auto formatted_text = get_formatted_text(td_->user_manager_.get(), std::move(texts[0]), max_media_timestamp == -1,