amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

[Datastore errorhandler] Incorporate a variable in error object to obtain the initial request.

Open amritnew opened this issue 1 year ago • 1 comments

Description

When an error is triggered within the Datastore error handler, there isn't any mechanism to obtain the original request for the client to retry. It's necessary to establish a means to access the request for the client to retry any failed requests effectively.

final datastorePlugin = AmplifyDataStore(
        modelProvider: ModelProvider.instance,

        // Error handler for any error occurs during datastore save
        errorHandler: (error) {
          print('AWS Error: $error');
        },

        syncExpressions: syncExpression);

Categories

  • [ ] Analytics
  • [ ] API (REST)
  • [ ] API (GraphQL)
  • [ ] Auth
  • [ ] Authenticator
  • [X] DataStore
  • [ ] Notifications (Push)
  • [ ] Storage

Steps to Reproduce

1.Create models as in schema 2. Initialize Datastore 3. Do Datastore.save() 4. Fails all incoming request in appsync or intercept iOS simulator request using any interceptor tool like Charles proxy OR Proxyman. 5. Analyze AmplifyException instance to retrieve original request.

Screenshots

No response

Platforms

  • [X] iOS
  • [ ] Android
  • [ ] Web
  • [ ] macOS
  • [ ] Windows
  • [ ] Linux

Flutter Version

3.19.0

Amplify Flutter Version

1.7.0

Deployment Method

Amplify CLI

Schema

type Todo @model {
    id: String!
    message: String!
    emails: [String!]!
    expirationUnixTime: AWSTimestamp
}

amritnew avatar May 10 '24 21:05 amritnew

Hi @amritnew, we will take a look at this issue and get back to you with any updates.

khatruong2009 avatar May 10 '24 23:05 khatruong2009