File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -174,13 +174,17 @@ export default class Database extends Base {
174
174
175
175
_handleDatabaseTransaction ( event ) {
176
176
const { id , originalValue } = event ;
177
- const updateCallback = this . transactions [ id ] ;
178
- const newValue = updateCallback ( originalValue ) ;
179
- let abort = false ;
180
- if ( newValue === undefined ) {
181
- abort = true ;
177
+ let newValue ;
178
+ try {
179
+ const updateCallback = this . transactions [ id ] ;
180
+ newValue = updateCallback ( originalValue ) ;
181
+ } finally {
182
+ let abort = false ;
183
+ if ( newValue === undefined ) {
184
+ abort = true ;
185
+ }
186
+ FirestackDatabase . tryCommitTransaction ( id , { value : newValue } , abort ) ;
182
187
}
183
- FirestackDatabase . tryCommitTransaction ( id , { value : newValue } , abort ) ;
184
188
}
185
189
186
190
/**
You can’t perform that action at this time.
0 commit comments