SignInWithAppleException.fromPlatformException constructor

SignInWithAppleException.fromPlatformException(
  1. PlatformException exception
)

Implementation

factory SignInWithAppleException.fromPlatformException(
  PlatformException exception,
) {
  switch (exception.code) {
    case 'not-supported':
      return SignInWithAppleNotSupportedException(
        message: exception.message ?? 'no message provided',
      );

    /// Exceptions which indicate an [SignInWithAppleAuthorizationError]
    case 'authorization-error/unknown':
      return SignInWithAppleAuthorizationException(
        code: AuthorizationErrorCode.unknown,
        message: exception.message ?? 'no message provided',
      );
    case 'authorization-error/canceled':
      return SignInWithAppleAuthorizationException(
        code: AuthorizationErrorCode.canceled,
        message: exception.message ?? 'no message provided',
      );
    case 'authorization-error/invalidResponse':
      return SignInWithAppleAuthorizationException(
        code: AuthorizationErrorCode.invalidResponse,
        message: exception.message ?? 'no message provided',
      );
    case 'authorization-error/notHandled':
      return SignInWithAppleAuthorizationException(
        code: AuthorizationErrorCode.notHandled,
        message: exception.message ?? 'no message provided',
      );
    case 'authorization-error/notInteractive':
      return SignInWithAppleAuthorizationException(
        code: AuthorizationErrorCode.notInteractive,
        message: exception.message ?? 'no message provided',
      );
    case 'authorization-error/failed':
      return SignInWithAppleAuthorizationException(
        code: AuthorizationErrorCode.failed,
        message: exception.message ?? 'no message provided',
      );

    case 'credentials-error':
      return SignInWithAppleCredentialsException(
        message: exception.message ?? 'no message provided',
      );

    default:
      return UnknownSignInWithAppleException(
        platformException: exception,
      );
  }
}