|
@@ -178,7 +178,7 @@ class State {
|
|
|
private inTransactionError = false;
|
|
|
|
|
|
/** Apply series of updates to the state. If any of them fail, revert to the original state. */
|
|
|
- transaction(edits: (ctx: RuntimeContext) => Promise<void> | void, options?: { canUndo?: string | boolean }) {
|
|
|
+ transaction(edits: (ctx: RuntimeContext) => Promise<void> | void, options?: { canUndo?: string | boolean, rethrowErrors?: boolean }) {
|
|
|
return Task.create('State Transaction', async ctx => {
|
|
|
const isNested = this.inTransaction;
|
|
|
|
|
@@ -207,6 +207,8 @@ class State {
|
|
|
this.inTransactionError = true;
|
|
|
throw e;
|
|
|
}
|
|
|
+
|
|
|
+ if (options?.rethrowErrors) throw e;
|
|
|
} finally {
|
|
|
if (!isNested) {
|
|
|
this.inTransaction = false;
|