onError = function(error) {
    var errorMessage = undefined;
    if (error && error['name'] && error['name'] == 'cancel') {
      return;
    }
    component.dispose();
    // Custom internal errors.
    switch (error && error['message']) {
      case 'anonymous-user-not-found':
        firebaseui.auth.widget.handler.handle(
            firebaseui.auth.widget.HandlerName.DIFFERENT_DEVICE_ERROR,
            app,
            container);
        break;
      case 'anonymous-user-mismatch':
        firebaseui.auth.widget.handler.handle(
            firebaseui.auth.widget.HandlerName.ANONYMOUS_USER_MISMATCH,
            app,
            container);
        break;
      case 'pending-credential-not-found':
        // Linking required and no pending credential found.
        firebaseui.auth.widget.handler.handle(
            firebaseui.auth.widget.HandlerName.EMAIL_LINK_NEW_DEVICE_LINKING,
            app,
            container,
            link,
            // Provider continue callback to get back the modified link without
            // provider ID.
            firebaseui.auth.widget.handler.continueEmailLinkSignIn_);
        break;
      default:
        // Show all other errors in nascar screen info bar.
        if (error) {
          errorMessage =
              firebaseui.auth.widget.handler.common.getErrorMessage(error);
        }
        firebaseui.auth.widget.handler.common.handleSignInStart(
            app, container, undefined, errorMessage);
    }
  }
Handles email link sign-in completion. Decides whether to allow sign-in
completion, ask the user for email, ask for consent when completing sign-in
without linking, etc.

@param {!firebaseui.auth.AuthUI} app The current Firebase UI instance whose
    configuration is used.
@param {!Element} container The container DOM element.
@param {string} link The link containing the OTP.
@param {?string=} opt_email The email address of the account if
    available.
@param {boolean=} opt_skipCodeCheck Whether to skip code check. This prevents
    multiple checks in the same flow. For example, this flow could trigger
    email confirmation and then email confirmation would redirect here.
    There is no need to check again in this case.