summaryrefslogtreecommitdiff
path: root/Userland/Applications/ImageViewer/main.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-11-24 00:23:00 +0100
committerAndreas Kling <kling@serenityos.org>2021-11-24 00:25:23 +0100
commitb6f49924bec74d93d52dae7b311938e37c68947e (patch)
tree6b55f53a1528fb57a442e6f97742ac4e691cb2e5 /Userland/Applications/ImageViewer/main.cpp
parent4a64bb80eaec84de46a12dac74c27cbf1a0b1bd8 (diff)
downloadserenity-b6f49924bec74d93d52dae7b311938e37c68947e.zip
LibDesktop: Make allowlist APIs return ErrorOr<void>
This makes it very smooth to use TRY() when setting up these lists, as you can see in the rest of this commit. :^)
Diffstat (limited to 'Userland/Applications/ImageViewer/main.cpp')
-rw-r--r--Userland/Applications/ImageViewer/main.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp
index b9fc9a88a5..e6cc44b60a 100644
--- a/Userland/Applications/ImageViewer/main.cpp
+++ b/Userland/Applications/ImageViewer/main.cpp
@@ -38,21 +38,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto app = TRY(GUI::Application::try_create(arguments));
- if (!Desktop::Launcher::add_allowed_handler_with_any_url("/bin/ImageViewer")) {
- warnln("Failed to set up allowed launch URLs");
- return 1;
- }
-
- if (!Desktop::Launcher::add_allowed_handler_with_only_specific_urls(
- "/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man1/ImageViewer.md") })) {
- warnln("Failed to set up allowed launch URLs");
- return 1;
- }
-
- if (!Desktop::Launcher::seal_allowlist()) {
- warnln("Failed to seal allowed launch URLs");
- return 1;
- }
+ TRY(Desktop::Launcher::add_allowed_handler_with_any_url("/bin/ImageViewer"));
+ TRY(Desktop::Launcher::add_allowed_handler_with_only_specific_urls("/bin/Help", { URL::create_with_file_protocol("/usr/share/man/man1/ImageViewer.md") }));
+ TRY(Desktop::Launcher::seal_allowlist());
auto app_icon = GUI::Icon::default_icon("filetype-image");