AuthenticatorException constructor

AuthenticatorException(
  1. Object exception, {
  2. bool showBanner = true,
})

An exception originating within the Authenticator as part of the sign up/ sign in flow.

Implementation

factory AuthenticatorException(
  Object exception, {
  bool showBanner = true,
}) {
  String message;
  if (exception is String) {
    message = exception;
  } else if (exception is AmplifyException) {
    message = exception.message;
  } else if (exception is SmithyException) {
    message = exception.message ?? _unknownMessage;
  } else {
    try {
      // ignore: avoid_dynamic_calls
      message = (exception as dynamic).message as String;
    } on Object {
      message = _unknownMessage;
    }
  }
  return AuthenticatorException._(
    message,
    showBanner: showBanner,
    underlyingException: exception,
  );
}