parseError method
method used to parse the error on the differents platform
Implementation
@override
Never parseError(Object error, StackTrace stackTrace) {
if (error is PlatformException) {
final errorCode = error.code;
if (errorCode.contains(errorCodesInterface.emailAlreadyInUseCode)) {
throw EmailAlreadyInUseExceptionInterface();
} else if (errorCode
.contains(errorCodesInterface.invalidEmailOrPasswordCode)) {
throw InvalidEmailOrPasswordExceptionInterface();
} else if (errorCode
.contains(errorCodesInterface.invalidVerificationCode)) {
throw InvalidVerificationCodeExceptionInterface();
} else if (errorCode.contains(errorCodesInterface.updateSamePassword)) {
throw UpdateSamePasswordExceptionInterface();
} else if (errorCode.contains(errorCodesInterface.invalidGrant)) {
throw InvalidGrantCodeExceptionInterface();
} else if (errorCode
.contains(errorCodesInterface.userCancelledOrClosedTheWebFlow)) {
throw UserCancelledOrClosedTheWebFlowCodeExceptionInterface();
} else if (errorCode
.contains(errorCodesInterface.socialAccountEmailAlreadyInUse)) {
throw SocialAccountEmailAlreadyInUseExceptionInterface();
} else if (errorCode
.contains(errorCodesInterface.unauthorizedRefreshToken)) {
throw UnauthorizedRefreshTokenExceptionInterface();
}
}
return Error.throwWithStackTrace(error, stackTrace);
}