summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorJulian Offenhäuser <offenhaeuser@protonmail.com>2022-11-10 22:42:44 +0100
committerAndreas Kling <kling@serenityos.org>2022-11-19 15:42:08 +0100
commit9b1331a984a45c4f941cd3e37de5feba43401209 (patch)
treea2bff4e937f9d4edffec290c9c2afacb11d13b5e /Userland/Applications
parente782d03f96afe96654b1d76c1207e2e77248422b (diff)
downloadserenity-9b1331a984a45c4f941cd3e37de5feba43401209.zip
PDFViewer: Simplify user-facing error messages
We now show a simple, if less helpful, message to the user and print the verbose error message to serial instead.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/PDFViewer/PDFViewer.cpp3
-rw-r--r--Userland/Applications/PDFViewer/PDFViewerWidget.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Applications/PDFViewer/PDFViewer.cpp b/Userland/Applications/PDFViewer/PDFViewer.cpp
index f69383a7cf..7c790d8def 100644
--- a/Userland/Applications/PDFViewer/PDFViewer.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewer.cpp
@@ -89,7 +89,8 @@ void PDFViewer::paint_event(GUI::PaintEvent& event)
return;
auto handle_error = [&](PDF::Error& error) {
- GUI::MessageBox::show_error(nullptr, String::formatted("Failed to render page:\n{}", error.message()));
+ warnln("{}", error.message());
+ GUI::MessageBox::show_error(nullptr, "Failed to render the page."sv);
m_document.clear();
};
diff --git a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
index 9e8792058e..bfcce0df06 100644
--- a/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
+++ b/Userland/Applications/PDFViewer/PDFViewerWidget.cpp
@@ -176,7 +176,8 @@ void PDFViewerWidget::open_file(Core::File& file)
auto handle_error = [&]<typename T>(PDF::PDFErrorOr<T> maybe_error) {
if (maybe_error.is_error()) {
auto error = maybe_error.release_error();
- GUI::MessageBox::show_error(nullptr, String::formatted("Couldn't load PDF {}:\n{}", file.filename(), error.message()));
+ warnln("{}", error.message());
+ GUI::MessageBox::show_error(nullptr, "Failed to load the document."sv);
return true;
}
return false;