1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 20:17:34 +00:00

Applications: Improve FSAC error message handling

Fixes apps showing redundant error messages and terminating
unnecessarily on failed file requests. It's nicer to drop the
user off at the equivalent of a default document on failure if
possible.

Also fixes TextEditor not showing response errors for missing files
in the recently opened list.
This commit is contained in:
thankyouverycool 2023-05-18 08:50:38 -04:00 committed by Andreas Kling
parent fef594708e
commit 444470b238
5 changed files with 17 additions and 19 deletions

View file

@ -53,9 +53,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
app->event_loop().deferred_invoke(
[&window, &path, &main_widget]() {
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window, path.value().to_deprecated_string());
if (response.is_error())
GUI::MessageBox::show_error(window, DeprecatedString::formatted("Opening \"{}\" failed: {}", path.value(), response.error()));
else {
if (!response.is_error()) {
auto load_from_file_result = main_widget->load_from_file(response.value().filename(), response.value().release_stream());
if (load_from_file_result.is_error())
GUI::MessageBox::show_error(window, DeprecatedString::formatted("Loading theme from file has failed: {}", load_from_file_result.error()));