Aws-sdk-ios: AWSMobileClient change password API can not give exactly exception when it failed

Created on 23 Feb 2019  路  2Comments  路  Source: aws-amplify/aws-sdk-ios

Describe the bug
When using AWSMobileClient API to change password, if user give incorrect current password, the API return error object is not instance of AWSMobileClientError to cast error. So I can not display error properly to user.

To Reproduce

 AWSMobileClient.sharedInstance().changePassword(currentPassword: currentPwd, proposedPassword: proposedPwd) { (error) in
              if error != nil {
                    log.info(error?.localizedDescription)
                    if let error = error as? AWSMobileClientError {
                      // Never be called
                    } else {
                       // Always be called
                    }
                } else {
                    // Success
                }
        }

Which AWS service(s) are affected?
AWSMobileClient

Expected behavior
Change password exception object should be instance of AWSMobileClient to cast error easier.

Environment(please complete the following information):

  • AWS iOS SDK Version: 2.9.0
  • Dependency Manager: CocoaPod
  • Swift Version : 4.0
  • Device: Iphone 6
  • iOS Version: 12.1.4
bug mobile client work in progress

All 2 comments

Hello @HayTran94

Sorry that you are having issues using the SDK.

I have root caused this issue to this line:
https://github.com/aws-amplify/aws-sdk-ios/blob/master/AWSAuthSDK/Sources/AWSMobileClient/AWSMobileClientExtensions.swift#L504

We are not casting the error to appropriate AWSMobileClientError. I am working on a fix for this issue and it will be fixed in an upcoming release.

Thanks,
Rohan

A fix for this issue was released with version 2.9.4.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

premiumbosslimited picture premiumbosslimited  路  3Comments

minhthuc251 picture minhthuc251  路  4Comments

pawlowskialex picture pawlowskialex  路  4Comments

mackoj picture mackoj  路  5Comments

anbarasu0504 picture anbarasu0504  路  3Comments