2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 15:35:51 +00:00

Remove read() constructors from MTP types.

This will allow us to handle errors in parsing not by exceptions.
This commit is contained in:
John Preston
2017-03-09 22:15:31 +03:00
parent 3b373e236e
commit 02da80439b
8 changed files with 1209 additions and 3612 deletions

View File

@@ -733,9 +733,11 @@ void Instance::Private::execCallback(mtpRequestId requestId, const mtpPrime *fro
if (from >= end) throw mtpErrorInsufficient();
if (*from == mtpc_rpc_error) {
RPCError err(MTPRpcError(from, end));
DEBUG_LOG(("RPC Info: error received, code %1, type %2, description: %3").arg(err.code()).arg(err.type()).arg(err.description()));
if (!rpcErrorOccured(requestId, h, err)) {
auto mtpError = MTPRpcError();
mtpError.read(from, end);
auto error = RPCError(mtpError);
DEBUG_LOG(("RPC Info: error received, code %1, type %2, description: %3").arg(error.code()).arg(error.type()).arg(error.description()));
if (!rpcErrorOccured(requestId, h, error)) {
QMutexLocker locker(&_parserMapLock);
_parserMap.emplace(requestId, h);
return;