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):
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.