-
Notifications
You must be signed in to change notification settings - Fork 202
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
SyncError in DataStore for ErrorHandler #3232
Comments
This issue was opened by a maintainer of this repository; updates will be posted here. If you are also experiencing this issue, please comment here with any relevant information so that we're aware and can prioritize accordingly. |
Don't know if I well understand the goal of this issue, but when I get synchronisation error, I can't find any information which could be used to fix the error.
I get an error on my error handler with only this kind of information:
Which don't help at all. Is this issue about the error content or is there another ? Moreover, the well received result are not insert in the datastore, but perhaps this might be another issue too ? |
Thank you for the example @gbitaudeau, this issue is to improve the usefulness of the error handler by providing a strongly typed error type like |
@gbitaudeau The response and errorHandler payload in your example is different from this issue. Could you open another issue to track this? The expected behavior of your example is the following
The actual behavior
|
Yes this level of information would be very useful: we can send this to our error tracker (like crashlytics) and take actions to resolve the issue (like a database clean, a migration or even a new application version). We could encounter this kind of problem after a new model version or unexpected evolutions errors. |
I opened #3259 |
This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you! |
I wanted to the scope the changes in this PR to simply pass back the info back to the developer and let them log whatever is called in the callback, and the only reasonable DataStoreError case to do that with is
DataStoreError.api
since it has the associated types of AmplifyError and MutationEvent. We were already doing this in some other places in this code, so i'm extending it to the missed cases. The long term plan is to have a similar error type as what JS calledSyncError
, which on iOS will conform to AmplifyError. The JS SyncError looks like this https://github.com/aws-amplify/amplify-js/blob/main/packages/datastore/src/types.ts#L933With this PR, I don't think a developer will reasonably be successful in handling the errorHandler callback (if i understand, this is what you're asking) becuase they need to check that it's a DataStoreError, with case
.api
, then cast the first parameter to APIError or GraphQLResponseError, and further check for.errors
case, and process the GraphQLError's. I think what this PR enables the developer is the ability to get visibility on sync errors, such they can log what's coming back from the errorHandler, which helps them and us debug their situation further. Later on, we can take the error processing logic here and map that to the SyncError. So for example, in this code, the developer receiving a callback on the errorHandler can cast the AmplifyError to SyncError, the processName should be "mutate". For unauthorized, it will be the errorType "Unauthorized", and for conditionalSaveFailed, it will most likely be "BadModel" (not 100% sure on this one). The mapping exercise we will have to do and synchronize with the JS's mapping logic.Originally posted by @lawmicha in #2532 (comment)
The text was updated successfully, but these errors were encountered: