Skip to content

Commit ac8f293

Browse files
authored
Clarify error handling behavior for nested transactions in docs (#1160)
1 parent e7d0edb commit ac8f293

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/api.md

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ insertMany([
7272

7373
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).
7474

75+
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.
76+
7577
```js
7678
const newExpense = db.prepare('INSERT INTO expenses (note, dollars) VALUES (?, ?)');
7779

0 commit comments

Comments
 (0)