code: function(error) {
          if (error['name'] && error['name'] == 'cancel') {
            // Close dialog.
            component.dismissDialog();
            return;
          }
          // Get error message.
          var errorMessage =
              firebaseui.auth.widget.handler.common.getErrorMessage(error);
          // Some errors are recoverable while others require resending the code.
          switch (error['code']) {
            case 'auth/credential-already-in-use':
              // Do nothing when anonymous user is getting upgraded.
              // Developer should handle this in signInFailure callback.
              component.dismissDialog();
              break;
            case 'auth/code-expired':
              // Expired code requires sending another request.
              // Render previous phone sign in start page and display error in
              // the info bar.
              var container = component.getContainer();
              // Close dialog.
              component.dismissDialog();
              component.dispose();
              firebaseui.auth.widget.handler.handle(
                  firebaseui.auth.widget.HandlerName.PHONE_SIGN_IN_START, app,
                  container, phoneNumberValue, errorMessage);
              break;
            case 'auth/missing-verification-code':
            case 'auth/invalid-verification-code':
              // Close dialog.
              component.dismissDialog();
              // As these errors are related to the code provided, it is better
              // to display inline.
              showInvalidCode(errorMessage);
              break;
            default:
              // Close dialog.
              component.dismissDialog();
              // Stay on the same page for all other errors and display error in
              // info bar.
              component.showInfoBar(errorMessage);
              break;
          }
        }
docs: On code verification failure.