diff --git a/Userland/Utilities/js.cpp b/Userland/Utilities/js.cpp index fa2ea3c4c9..8770f4fe2e 100644 --- a/Userland/Utilities/js.cpp +++ b/Userland/Utilities/js.cpp @@ -1493,11 +1493,7 @@ ErrorOr serenity_main(Main::Arguments arguments) StringBuilder builder; for (auto& path : script_paths) { - auto file = Core::File::construct(path); - if (!file->open(Core::OpenMode::ReadOnly)) { - warnln("Failed to open {}: {}", path, file->error_string()); - return 1; - } + auto file = TRY(Core::File::open(path, Core::OpenMode::ReadOnly)); auto file_contents = file->read_all(); auto source = StringView { file_contents }; builder.append(source);