From 9b1331a984a45c4f941cd3e37de5feba43401209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Offenh=C3=A4user?= Date: Thu, 10 Nov 2022 22:42:44 +0100 Subject: [PATCH] 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. --- Userland/Applications/PDFViewer/PDFViewer.cpp | 3 ++- Userland/Applications/PDFViewer/PDFViewerWidget.cpp | 3 ++- 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 = [&](PDF::PDFErrorOr 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;