1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:57:35 +00:00

SystemServer: Add Service::try_create to propagate errors

This static method is used to propagate errors at the creation of the
object.
This commit is contained in:
Lucas CHOLLET 2022-06-08 18:29:08 +02:00 committed by Andreas Kling
parent dd3b65c762
commit 23fa6b1f7b
3 changed files with 25 additions and 20 deletions

View file

@ -487,8 +487,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto config = (user)
? TRY(Core::ConfigFile::open_for_app("SystemServer"))
: TRY(Core::ConfigFile::open_for_system("SystemServer"));
for (auto name : config->groups()) {
auto service = Service::construct(*config, name);
for (auto const& name : config->groups()) {
auto service = TRY(Service::try_create(*config, name));
if (service->is_enabled())
services.append(service);
}