summaryrefslogtreecommitdiff
path: root/Userland/Applications/TextEditor/main.cpp
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2023-05-18 08:50:38 -0400
committerAndreas Kling <kling@serenityos.org>2023-05-19 06:20:41 +0200
commit444470b238eb5fa4905d1fa5383931ef84bf6a41 (patch)
tree3eae27bcaa71ca9af465a75a878a1a58a32a016e /Userland/Applications/TextEditor/main.cpp
parentfef594708eec1c1d26b54c26b09e40f1df1ed99c (diff)
downloadserenity-444470b238eb5fa4905d1fa5383931ef84bf6a41.zip
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.
Diffstat (limited to 'Userland/Applications/TextEditor/main.cpp')
-rw-r--r--Userland/Applications/TextEditor/main.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Applications/TextEditor/main.cpp b/Userland/Applications/TextEditor/main.cpp
index a6b6e09c82..11cab94012 100644
--- a/Userland/Applications/TextEditor/main.cpp
+++ b/Userland/Applications/TextEditor/main.cpp
@@ -76,19 +76,20 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (!file_to_edit.is_empty()) {
auto filename = TRY(String::from_utf8(file_to_edit));
FileArgument parsed_argument(filename);
+
+ FileSystemAccessClient::Client::the().set_silence_errors(FileSystemAccessClient::ErrorFlag::NoEntries);
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window, parsed_argument.filename().to_deprecated_string());
if (response.is_error()) {
if (response.error().code() == ENOENT)
text_widget->open_nonexistent_file(parsed_argument.filename().to_deprecated_string());
- else
- return 1;
} else {
TRY(text_widget->read_file(response.value().filename(), response.value().stream()));
text_widget->editor().set_cursor_and_focus_line(parsed_argument.line().value_or(1) - 1, parsed_argument.column().value_or(0));
}
text_widget->update_title();
+ FileSystemAccessClient::Client::the().set_silence_errors(FileSystemAccessClient::ErrorFlag::None);
}
text_widget->update_statusbar();