bool rpcErrorOccured(mtpRequestId requestId, const RPCFailHandlerPtr &onFail, const RPCError &err) { // return true if need to clean request data if (mtpIsFlood(err)) { if (onFail && (*onFail)(requestId, err)) return true; } if (onErrorDefault(requestId, err)) { return false; } LOG(("RPC Error: request %1 got fail with code %2, error %3%4").arg(requestId).arg(err.code()).arg(err.type()).arg(err.description().isEmpty() ? QString() : QString(": %1").arg(err.description()))); onFail && (*onFail)(requestId, err); return true; }
bool ConfirmPhoneBox::sendCodeFail(const RPCError &error) { auto errorText = lang(lng_server_error); if (MTP::isFloodError(error)) { errorText = lang(lng_flood_error); } else if (MTP::isDefaultHandledError(error)) { return false; } else if (error.code() == 400) { errorText = lang(lng_confirm_phone_link_invalid); } _sendCodeRequestId = 0; Ui::show(Box<InformBox>(errorText)); if (this == CurrentConfirmPhoneBox) { CurrentConfirmPhoneBox.destroyDelayed(); } else { deleteLater(); } return true; }