Skip to content

Commit

Permalink
- catch exception if requesting service name fails
Browse files Browse the repository at this point in the history
  • Loading branch information
aschnell committed Jun 4, 2021
1 parent 2c1e17d commit bc8c147
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/snapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ main(int argc, char** argv)
}
catch (const runtime_error& e)
{
cerr << _("Failed to set locale. Fix your system.") << endl;
cerr << _("Failed to set locale.") << endl;
}

setLogDo(&log_do);
Expand Down
17 changes: 14 additions & 3 deletions server/snapperd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,18 @@ main(int argc, char** argv)

y2mil("Requesting DBus name");

mainloop.request_name(SERVICE, DBUS_NAME_FLAG_REPLACE_EXISTING);
try
{
mainloop.request_name(SERVICE, DBUS_NAME_FLAG_REPLACE_EXISTING);
}
catch (const Exception& e)
{
SN_CAUGHT(e);

y2err("Failed to request DBus name");

return EXIT_FAILURE;
}

y2mil("Loading snapper configs");

Expand All @@ -287,7 +298,7 @@ main(int argc, char** argv)
{
SN_CAUGHT(e);

y2err("failed to load snapper configs");
y2err("Failed to load snapper configs");
}

y2mil("Listening for method calls and signals");
Expand All @@ -298,5 +309,5 @@ main(int argc, char** argv)

meta_snappers.unload();

return 0;
return EXIT_SUCCESS;
}

0 comments on commit bc8c147

Please sign in to comment.