1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:57:44 +00:00

Everywhere: Split Error::from_string_literal and Error::from_string_view

Error::from_string_literal now takes direct char const*s, while
Error::from_string_view does what Error::from_string_literal used to do:
taking StringViews. This change will remove the need to insert `sv`
after error strings when returning string literal errors once
StringView(char const*) is removed.

No functional changes.
This commit is contained in:
sin-ack 2022-07-11 17:57:32 +00:00 committed by Andreas Kling
parent c70f45ff44
commit e5f09ea170
51 changed files with 282 additions and 261 deletions

View file

@ -128,7 +128,7 @@ ErrorOr<off_t> print_space_usage(String const& path, DuOption const& du_option,
auto di = Core::DirIterator(path, Core::DirIterator::SkipParentAndBaseDir);
if (di.has_error()) {
outln("du: cannot read directory '{}': {}", path, di.error_string());
return Error::from_string_literal("An error occurred. See previous error."sv);
return Error::from_string_literal("An error occurred. See previous error.");
}
while (di.has_next()) {

View file

@ -11,7 +11,7 @@ ErrorOr<int> serenity_main(Main::Arguments)
{
auto document = Video::MatroskaReader::parse_matroska_from_file("/home/anon/Videos/test-webm.webm");
if (!document) {
return Error::from_string_literal("Failed to parse :("sv);
return Error::from_string_literal("Failed to parse :(");
}
outln("DocType is {}", document->header().doc_type.characters());

View file

@ -36,7 +36,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (account.has_password()) {
auto password = TRY(Core::get_password());
if (!account.authenticate(password))
return Error::from_string_literal("Incorrect or disabled password."sv);
return Error::from_string_literal("Incorrect or disabled password.");
}
}

View file

@ -848,7 +848,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
int status;
if (g_pid == -1) {
if (child_argv.is_empty())
return Error::from_string_literal("Expected either a pid or some arguments"sv);
return Error::from_string_literal("Expected either a pid or some arguments");
auto pid = TRY(Core::System::fork());