aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.29k stars 239 forks source link

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

Open amritnew opened 4 weeks ago

amritnew commented 4 weeks ago

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

Steps to Reproduce

1.Create models as in schema

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

Screenshots

No response

Platforms

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
}
khatruong2009 commented 4 weeks ago

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