mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-30 08:41:15 +00:00
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.
This commit is contained in:
parent
e782d03f96
commit
9b1331a984
Notes:
sideshowbarker
2024-07-17 04:19:58 +09:00
Author: https://github.com/janso3 Commit: https://github.com/SerenityOS/serenity/commit/9b1331a984 Pull-request: https://github.com/SerenityOS/serenity/pull/16015 Reviewed-by: https://github.com/mattco98 ✅
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue