Clarify error handling behavior for nested transactions in docs

Co-authored-by: Niklas Wenzel <[email protected]>
This commit is contained in:
Mahesh Bandara Wijerathna
2024-04-05 10:00:58 +05:30
co-authored by Niklas Wenzel
parent e59c67d03d
commit f7ee3351e8
+2
View File
@@ -74,6 +74,8 @@ insertMany([
Transaction functions can be called from inside other transaction functions. When doing so, the inner transaction becomes a [savepoint](https://www.sqlite.org/lang_savepoint.html).
If an error is thrown inside of a nested transaction function, the nested transaction function will roll back to the state just before the savepoint and rethrow the error. If the error is not caught in the outer transaction function, this will cause the outer transaction function to roll back as well.
```js
const newExpense = db.prepare('INSERT INTO expenses (note, dollars) VALUES (?, ?)');