@@ -146,16 +146,31 @@ class AuthUserServiceAdapter: AuthUserServiceBehavior {
146
146
completionHandler ( . success( ( ) ) )
147
147
return
148
148
}
149
- if let awsMobileClientError = error as? AWSMobileClientError ,
150
- case . notSignedIn = awsMobileClientError {
151
- let authError = AuthError . signedOut (
152
- AuthPluginErrorConstants . changePasswordSignedOutError. errorDescription,
153
- AuthPluginErrorConstants . changePasswordSignedOutError. recoverySuggestion, nil )
154
- completionHandler ( . failure( authError) )
155
- } else {
149
+
150
+ guard let awsMobileClientError = error as? AWSMobileClientError else {
156
151
let authError = AuthErrorHelper . toAuthError ( error)
157
152
completionHandler ( . failure( authError) )
153
+ return
154
+ }
155
+
156
+ let authError : AuthError
157
+ switch awsMobileClientError {
158
+ case . notSignedIn:
159
+ authError = AuthError . signedOut (
160
+ AuthPluginErrorConstants . changePasswordSignedOutError. errorDescription,
161
+ AuthPluginErrorConstants . changePasswordSignedOutError. recoverySuggestion,
162
+ nil
163
+ )
164
+ case . unableToSignIn:
165
+ authError = AuthError . sessionExpired (
166
+ AuthPluginErrorConstants . changePasswordUnableToSignInError. errorDescription,
167
+ AuthPluginErrorConstants . changePasswordUnableToSignInError. recoverySuggestion,
168
+ nil
169
+ )
170
+ default :
171
+ authError = AuthErrorHelper . toAuthError ( error)
158
172
}
173
+ completionHandler ( . failure( authError) )
159
174
}
160
175
161
176
}
0 commit comments