PDFViewer: Inform users of underlying issue when loading document

While this is not super useful to end users, it's still better than the
simpler, generic "failed to load" error message.
This commit is contained in:
Rodrigo Tobar 2023-01-05 23:53:12 +08:00 committed by Andreas Kling
commit b406f1d5a4
Notes: sideshowbarker 2024-07-17 03:18:29 +09:00

View file

@ -355,7 +355,8 @@ void PDFViewerWidget::open_file(Core::File& file)
if (maybe_error.is_error()) { if (maybe_error.is_error()) {
auto error = maybe_error.release_error(); auto error = maybe_error.release_error();
warnln("{}", error.message()); warnln("{}", error.message());
GUI::MessageBox::show_error(nullptr, "Failed to load the document."sv); auto user_error_message = DeprecatedString::formatted("Failed to load the document. Error:\n{}.", error.message());
GUI::MessageBox::show_error(nullptr, user_error_message.view());
} }
} }