mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 10:27:36 +00:00
LibThreading+Everywhere: Support returning error from BackgroundAction
This patch allows returning an `Error` from the `on_complete` callback in `BackgroundAction`. It also adds a custom callback to manage errors returned during its execution.
This commit is contained in:
parent
664117564a
commit
2693745336
6 changed files with 38 additions and 21 deletions
|
@ -144,8 +144,9 @@ void FileProvider::query(DeprecatedString const& query, Function<void(NonnullRef
|
|||
}
|
||||
return results;
|
||||
},
|
||||
[on_complete = move(on_complete)](auto results) {
|
||||
[on_complete = move(on_complete)](auto results) -> ErrorOr<void> {
|
||||
on_complete(move(results));
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -192,8 +193,9 @@ void FileProvider::build_filesystem_cache()
|
|||
dbgln("Built cache in {} ms", timer.elapsed());
|
||||
return 0;
|
||||
},
|
||||
[this](auto) {
|
||||
[this](auto) -> ErrorOr<void> {
|
||||
m_building_cache = false;
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue