@@ -211,10 +211,7 @@ void Connection::assumeIdentity(const QString& mxId, const QString& accessToken)
211211            d->completeSetup (job->userId ());
212212        });
213213        connect (job, &BaseJob::failure, this , [this , job] {
214-             if  (job->error () == BaseJob::StatusCode::NetworkError)
215-                 emit networkError (job->errorString (), job->rawDataSample (),
216-                                   job->maxRetries (), -1 );
217-             else 
214+             if  (job->error () != BaseJob::StatusCode::NetworkError)
218215                emit loginError (job->errorString (), job->rawDataSample ());
219216        });
220217    });
@@ -448,11 +445,6 @@ void Connection::sync(int timeout)
448445        d->syncJob  = nullptr ;
449446        emit syncDone ();
450447    });
451-     connect (job, &SyncJob::retryScheduled, this ,
452-             [this , job](int  retriesTaken, int  nextInMilliseconds) {
453-                 emit networkError (job->errorString (), job->rawDataSample (),
454-                                   retriesTaken, nextInMilliseconds);
455-             });
456448    connect (job, &SyncJob::failure, this , [this , job] {
457449        //  SyncJob persists with retries on transient errors; if it fails,
458450        //  there's likely something serious enough to stop the loop.
@@ -1624,6 +1616,11 @@ BaseJob* Connection::run(BaseJob* job, RunningPolicy runningPolicy)
16241616    //  Reparent to protect from #397, #398 and to prevent BaseJob* from being
16251617    //  garbage-collected if made by or returned to QML/JavaScript.
16261618    job->setParent (this );
1619+     connect (job, &BaseJob::retryScheduled, this ,
1620+             [this , job](int  retriesTaken, int  nextInMilliseconds) {
1621+                 emit networkError (job->errorString (), job->rawDataSample (),
1622+                                   retriesTaken, nextInMilliseconds);
1623+             });
16271624    connect (job, &BaseJob::failure, this , &Connection::requestFailed);
16281625    job->initiate (d->data .get (), runningPolicy & BackgroundRequest);
16291626    return  job;
0 commit comments