Open
Description
Operating System
macOS
Browser Version
Safari 16.5.2
Firebase SDK Version
10.7.1
Firebase SDK Product:
Database
Describe your project's tooling
index.html with source tag. Just javascript.
Describe the problem
runTransaction errors can not be caught.
Steps and code to reproduce issue
Start with the database empty.
var db = getDatabase();
connectDatabaseEmulator(db, '127.0.0.1', 9000);
await update(ref(db, "users/testUser/starCount"), { starCount: increment(1) });
try {
await runTransaction(ref(db, "users/testUser"), post => {
console.log(post);
if (post) {
var starCount = post["starCount"];
starCount++;
post["starCount"] = starCount;
return post;
} else {
return null;
}
});
} catch (e) {//it never reaches catch
console.error("transaction error");
console.error(e);
}
The following error shows up on the console
Error: transaction failed: Data returned contains NaN in property 'users.testUser.starCount'
However, the error can never be caught. I also tried using a try catch block inside the transaction itself, and it still didn't work.