RunControllableTask now also properly catches Exceptions and reports them through the Future.

This commit is contained in:
eelke 2019-01-29 19:39:21 +01:00
parent 39ac8ef02d
commit 3820fb2600

View file

@ -34,14 +34,23 @@ public:
return; return;
} }
TaskControl control(this); TaskControl control(this);
try {
result = this->task->run(control); result = this->task->run(control);
if (!this->isCanceled()) { if (!this->isCanceled()) {
this->reportResult(result); this->reportResult(result);
} }
} catch (QException &e) {
reportException(e);
} catch (...) {
reportException(QUnhandledException());
}
this->reportFinished(); this->reportFinished();
} }
private:
T result; T result;
ControllableTask<T> *task; ControllableTask<T> *task;
}; };
#endif // RUNCONTROLLABLETASK_H #endif // RUNCONTROLLABLETASK_H