-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
♻ Throw error for pending ops on hard rollback #626
Conversation
066ef69
to
4ae9c50
Compare
4ae9c50
to
96ee0ce
Compare
From discussion between @dawidreedsy, @alecgibson, Edmond, and me: For soft-rejecting an op:
That behavior should apply to edit, create, and del. |
92adad5
to
16ae32e
Compare
16ae32e
to
9428deb
Compare
Our current flow for handling the rollback swallows some errors and discards pending ops. 1. Whenever we do hard rollback and fetch for hard rollback fails we should throw the error so that user is informed that something really wrong happen. 2. Whenever we preform the hard rollback and we have some pending ops and the `ERR_OP_PENDING_OP_SUBMIT_REJECTED` error is thrown we should soft reject, as this error is meant for the user to reject some of the ops from submition to DB, however we should throw for all the pending ops s the pending ops would be otherwise just discarded. This way we at least allow user to handle the error 3. For the soft rollback we just resolve for this error and allow pending ops to be submitted to the server.
9428deb
to
5a3bbfd
Compare
var doc = connection.get('dogs', 'fido'); | ||
doc.preventCompose = true; | ||
|
||
doc.create({age: 3}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot really as we check create without callback
Our current flow for handling the rollback swallows some errors and discards pending ops.
ERR_OP_PENDING_OP_SUBMIT_REJECTED
error is thrown we should soft reject, as this error is meant for the user to reject some of the ops from submition to DB, however we should throw for all the pending ops s the pending ops would be otherwise just discarded. This way we at least allow user to handle the errorThis PR is extracted from: