in packages/amplify_auth_cognito/ios/Classes/AuthErrorHandler.swift [25:113]
func handleAuthError(authError: AmplifyError, flutterResult: FlutterResult){
var exception: String = "AuthException"
if authError is AuthError {
if case .service(_, _, let error) = authError as! AuthError{
if (error is AWSCognitoAuthError) {
switch error as? AWSCognitoAuthError {
case .aliasExists:
exception = "AliasExistsException"
case .codeDelivery:
exception = "CodeDeliveryFailureException"
case .codeExpired:
exception = "CodeExpiredException"
case .codeMismatch:
exception = "CodeMismatchException"
//TODO: Determine equivalent Android exception
case .deviceNotTracked:
exception = "DeviceNotTrackedException"
//TODO: Investigate Android case
case .errorLoadingUI:
exception = "AuthException"
case .failedAttemptsLimitExceeded:
exception = "FailedAttemptsLimitExceededException"
case .invalidAccountTypeException:
exception = "InvalidAccountTypeException"
case .invalidParameter:
exception = "InvalidParameterException"
case .invalidPassword:
exception = "InvalidPasswordException"
case .lambda:
exception = "LambdaException"
case .limitExceeded:
exception = "LimitExceededException"
case .mfaMethodNotFound:
exception = "MFAMethodNotFoundException"
//TODO: Determine equivalent Android exception
case .network:
exception = "AuthException"
case .passwordResetRequired:
exception = "PasswordResetRequiredException"
case .requestLimitExceeded:
exception = "TooManyRequestsException"
case .resourceNotFound:
exception = "ResourceNotFoundException"
case .softwareTokenMFANotEnabled:
exception = "SoftwareTokenMFANotFoundException"
case .userCancelled:
exception = "UserCancelledException"
case .usernameExists:
exception = "UsernameExistsException"
case .userNotConfirmed:
exception = "UserNotConfirmedException"
case .userNotFound:
exception = "UserNotFoundException"
case .none:
exception = "AuthException"
}
}
}
if case .configuration = authError as! AuthError {
exception = "ConfigurationException"
}
if case .unknown = authError as! AuthError {
exception = "UnknownException"
}
if case .invalidState = authError as! AuthError {
exception = "InvalidStateException"
}
if case .notAuthorized = authError as! AuthError {
exception = "NotAuthorizedException"
}
if case .validation = authError as! AuthError {
exception = "InvalidParameterException"
}
if case .signedOut = authError as! AuthError {
exception = "SignedOutException"
}
if case .sessionExpired = authError as! AuthError {
exception = "SessionExpiredException"
}
}
let details: Dictionary<String, String> = createSerializedError(authError: authError)
logErrorContents(error: authError)
ErrorUtil.postErrorToFlutterChannel(result: flutterResult,
errorCode: exception,
details: details)
}