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);
result = this->task->run(control); try {
if (!this->isCanceled()) { result = this->task->run(control);
this->reportResult(result); if (!this->isCanceled()) {
this->reportResult(result);
}
} catch (QException &e) {
reportException(e);
} catch (...) {
reportException(QUnhandledException());
} }
this->reportFinished(); this->reportFinished();
} }
T result; private:
T result;
ControllableTask<T> *task; ControllableTask<T> *task;
}; };
#endif // RUNCONTROLLABLETASK_H #endif // RUNCONTROLLABLETASK_H