tasks: fail if a task was aborted

run() method of task_manager::task::impl does not have to throw when
a task is aborted with task manager api. Thus, a user will see that
the task finished successfully which makes it inconsistent.

Finish a task with a failure if it was aborted with task manager api.
This commit is contained in:
Aleksandra Martyniuk
2023-08-17 16:37:14 +02:00
parent 599d6ebd52
commit 2a9ee59cc4

View File

@@ -124,7 +124,12 @@ void task_manager::task::impl::run_to_completion() {
if (f.failed()) {
finish_failed(f.get_exception());
} else {
finish();
try {
_as.check();
finish();
} catch (...) {
finish_failed(std::current_exception());
}
}
});
}