1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +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

@ -90,7 +90,7 @@ ErrorOr<void> Database::add_schema(SchemaDef const& schema)
VERIFY(is_open());
if (!m_schemas->insert(schema.key())) {
warnln("Duplicate schema name {}"sv, schema.name());
return Error::from_string_literal("Duplicate schema name"sv);
return Error::from_string_literal("Duplicate schema name");
}
return {};
}
@ -127,7 +127,7 @@ ErrorOr<void> Database::add_table(TableDef& table)
VERIFY(is_open());
if (!m_tables->insert(table.key())) {
warnln("Duplicate table name '{}'.'{}'"sv, table.parent()->name(), table.name());
return Error::from_string_literal("Duplicate table name"sv);
return Error::from_string_literal("Duplicate table name");
}
for (auto& column : table.columns()) {
VERIFY(m_table_columns->insert(column.key()));
@ -159,7 +159,7 @@ ErrorOr<RefPtr<TableDef>> Database::get_table(String const& schema, String const
auto schema_def = TRY(get_schema(schema));
if (!schema_def) {
warnln("Schema '{}' does not exist"sv, schema);
return Error::from_string_literal("Schema does not exist"sv);
return Error::from_string_literal("Schema does not exist");
}
auto ret = TableDef::construct(schema_def, name);
ret->set_pointer((*table_iterator).pointer());