@@ -15,7 +15,8 @@ import 'package:meta/meta.dart';
15
15
export 'package:amplify_core/src/types/datastore/datastore_types.dart'
16
16
hide DateTimeParse;
17
17
18
- class AmplifyDataStore extends DataStorePluginInterface {
18
+ class AmplifyDataStore extends DataStorePluginInterface
19
+ with AWSDebuggable , AmplifyLoggerMixin {
19
20
/// Constructs an AmplifyDataStore plugin with mandatory [modelProvider]
20
21
/// and optional datastore configuration properties including
21
22
///
@@ -77,16 +78,13 @@ class AmplifyDataStore extends DataStorePluginInterface {
77
78
} on PlatformException catch (e) {
78
79
if (e.code.contains ('AmplifyAlreadyConfiguredException' ) ||
79
80
e.code.contains ('AlreadyConfiguredException' )) {
80
- throw const AmplifyAlreadyConfiguredException (
81
- AmplifyExceptionMessages .alreadyConfiguredDefaultMessage,
82
- recoverySuggestion:
83
- AmplifyExceptionMessages .alreadyConfiguredDefaultSuggestion,
81
+ logger.debug ('Ignoring Amplify Native already configured exception' );
82
+ } else {
83
+ throw ConfigurationError (
84
+ e.message ?? 'An unknown error occurred' ,
85
+ underlyingException: e,
84
86
);
85
87
}
86
- throw ConfigurationError (
87
- e.message ?? 'An unknown error occurred' ,
88
- underlyingException: e,
89
- );
90
88
}
91
89
// Update the native cache for the current user on hub events.
92
90
Future <void > updateCurrentUser (AuthUser ? currentUser) async {
@@ -129,16 +127,13 @@ class AmplifyDataStore extends DataStorePluginInterface {
129
127
} on PlatformException catch (e) {
130
128
if (e.code.contains ('AmplifyAlreadyConfiguredException' ) ||
131
129
e.code.contains ('AlreadyConfiguredException' )) {
132
- throw const AmplifyAlreadyConfiguredException (
133
- AmplifyExceptionMessages .alreadyConfiguredDefaultMessage,
134
- recoverySuggestion:
135
- AmplifyExceptionMessages .alreadyConfiguredDefaultSuggestion,
130
+ logger.debug ('Ignoring Amplify Native already configured exception' );
131
+ } else {
132
+ throw ConfigurationError (
133
+ e.message ?? 'An unknown error occurred' ,
134
+ underlyingException: e,
136
135
);
137
136
}
138
- throw ConfigurationError (
139
- e.message ?? 'An unknown error occurred' ,
140
- underlyingException: e,
141
- );
142
137
}
143
138
}
144
139
@@ -154,6 +149,7 @@ class AmplifyDataStore extends DataStorePluginInterface {
154
149
Map <String , String >.from (e.details as Map ),
155
150
);
156
151
} else if (e.code == 'AmplifyAlreadyConfiguredException' ) {
152
+ logger.debug ('Ignoring Amplify Native already configured exception' );
157
153
return ;
158
154
} else {
159
155
// This shouldn't happen. All exceptions coming from platform for
@@ -253,6 +249,9 @@ class AmplifyDataStore extends DataStorePluginInterface {
253
249
throttleOptions: throttleOptions,
254
250
);
255
251
}
252
+
253
+ @override
254
+ String get runtimeTypeName => 'AmplifyDataStore' ;
256
255
}
257
256
258
257
class _NativeAmplifyAuthCognito
0 commit comments