-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Record details about replication action and associated document, if any, upon replication failure. #3630
Record details about replication action and associated document, if any, upon replication failure. #3630
Conversation
I'm not positive I'm testing this properly either, so please that give a good look. It also took me a very long time to get the tests in a good state. Is there a way to easily run just a single test or a way to debug one? I'm not familiar at all with the test runner being used. Consequently, my solution was to delete a bunch of tests temporarily and then run all remaining tests everytime I wanted to make a change. That still took several minutes, making this a very slow development effort. |
Yes the test runner is pretty outdated. I also just commend out tests here Public facing types are prefixed with |
Thanks for the review. It'll probably be a few days before I can get everything updated. |
dee8b9a
to
903b92a
Compare
903b92a
to
50d1261
Compare
@pubkey I've rebased the branch against master and updated the GraphQL Replication docs. I have two outstanding questions:
I know there's a desire to base GraphQL replication on custom replication. I can help with that in a future PR. When they're merged, I'll have a much easier time testing the error handling since I'll be using it in my own application. But, if you want the error wrapping added for custom replication now, that's sensible, too. When you get a chance, please take a look and let me know what you'd like to see done before approving the PR. Thanks! |
50d1261
to
88b1035
Compare
docs-src/replication-graphql.md
Outdated
GraphQL errors are wrapped in a `RxReplicationError`, which has a `payload` property with information to help you handle the underlying error. | ||
The payload has a `type` field with a value of `"pull"` or `"push"`, corresponding to an error in either a GraphQL pull or push replication operation, respectively. | ||
If the error occurs doing a _push_, the `payload` also contains a `documentData` property, which corresponds to the document data supplied to the push query builder. | ||
NB: You may see errors in this observable that are not `RxReplicationError`. |
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.
Is "NB:" for "nota bene"?
We shouldn't use these abbreviation because most readers of the docs a from non-latin based mother languages.
In other parts I did it like 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.
Thanks for taking a look. I hadn't considered the language barrier. Changing it is easy enough. Is it okay to use "e.g."? That's another Latin abbreviation.
We do not need this for the couchdb replication for now. I have no opinion about having non-RxReplicationError in the same stream. We can leave that for now. Maybe we should add an 'internal' error type in the future. Or some other way to determine if an error is expected or a problem in the code. If you want to, you can add the improved error handling also to the replications plugin. But I am also ok with not having that for now. Code looks good for me, I added one comment to the docs. |
…ny, upon replication failure.
88b1035
to
e3f8d1c
Compare
Thanks for the review. I've updated the documentation issue you highlighted. |
This PR contains:
Describe the problem you have without this PR
This PR is a proposed solution to #3622. Errors encountered during GraphQL replication are wrapped in a new
ReplicationError
object that records whether it was a pull or push replication that failed, and if a push failure, the associated document data in the failed request.For the time being, I've only applied these changes to GraphQL replication, although I think it could be handled for all forms of replication. There were a variety of design decisions made in getting this far and I'm happy to adjust as necessary. I just wanted to get something functional that could then be evaluated. Some areas that would be helpful to get feedback on are:
error$
in this case is aReplicationError
. I have kept it asany
for the time being to avoid any future issues with the type definition changing. When typed asany
, a client should not be relying on anything about the object structure.To give an example of how I'm making use of this new feature, here's code from my client handling a uniqueness constraint violation from the GraphQL server:
Todos