File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,8 @@ func (wb *WriteBatch) commit() error {
181
181
return wb .err
182
182
}
183
183
if err := wb .throttle .Do (); err != nil {
184
- return err
184
+ wb .err = err
185
+ return wb .err
185
186
}
186
187
wb .txn .CommitWith (wb .callback )
187
188
wb .txn = wb .db .newTransaction (true , wb .isManaged )
@@ -193,11 +194,15 @@ func (wb *WriteBatch) commit() error {
193
194
// returns any error stored by WriteBatch.
194
195
func (wb * WriteBatch ) Flush () error {
195
196
wb .Lock ()
197
+ // commit will set the wb.err so no need to check the error here.
196
198
_ = wb .commit ()
197
199
wb .txn .Discard ()
198
200
wb .Unlock ()
199
201
200
202
if err := wb .throttle .Finish (); err != nil {
203
+ if wb .err != nil {
204
+ return errors .Errorf ("wb.err: %s err: %s" , wb .err , err )
205
+ }
201
206
return err
202
207
}
203
208
You can’t perform that action at this time.
0 commit comments