LibWeb/IDB: Improve error messages related to transaction state

This commit is contained in:
stelar7
2025-04-29 17:24:30 +02:00
committed by Jelle Raaijmakers
parent 6237824d99
commit 0890b10d11
Notes: github-actions[bot] 2025-05-06 09:18:32 +00:00
3 changed files with 9 additions and 7 deletions

View File

@@ -109,7 +109,7 @@ WebIDL::ExceptionOr<GC::Ref<IDBObjectStore>> IDBDatabase::create_object_store(St
// 3. If transactions state is not active, then throw a "TransactionInactiveError" DOMException.
if (transaction->state() != IDBTransaction::TransactionState::Active)
return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active"_string);
return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active while creating object store"_string);
// 4. Let keyPath be optionss keyPath member if it is not undefined or null, or null otherwise.
auto key_path = options.key_path;
@@ -171,7 +171,7 @@ WebIDL::ExceptionOr<void> IDBDatabase::delete_object_store(String const& name)
// 3. If transactions state is not active, then throw a "TransactionInactiveError" DOMException.
if (transaction->state() != IDBTransaction::TransactionState::Active)
return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active"_string);
return WebIDL::TransactionInactiveError::create(realm, "Transaction is not active while deleting object store"_string);
// 4. Let store be the object store named name in database, or throw a "NotFoundError" DOMException if none.
auto store = database->object_store_with_name(name);