RunControllableTask now also properly catches Exceptions and reports them through the Future.
This commit is contained in:
parent
39ac8ef02d
commit
3820fb2600
1 changed files with 13 additions and 4 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue