private static @NotNull FailureResultImpl createFailureResult(
    @NotNull Throwable exception,
    @NotNull ProjectSystemId externalSystemId,
    @NotNull Project project,
    @NotNull ExternalSystemNotificationManager notificationManager,
    @NotNull NotificationData notificationData
  ) {
    if (notificationData.isBalloonNotification()) {
      notificationManager.showNotification(externalSystemId, notificationData);
      return new FailureResultImpl(exception);
    }

    final NotificationGroup group;
    if (notificationData.getBalloonGroup() == null) {
      var externalProjectsView = ExternalProjectsManagerImpl.getInstance(project)
        .getExternalProjectsView(externalSystemId);
      group = externalProjectsView instanceof ExternalProjectsViewImpl ?
              ((ExternalProjectsViewImpl)externalProjectsView).getNotificationGroup() : null;
    }
    else {
      group = notificationData.getBalloonGroup();
    }
    var line = notificationData.getLine() - 1;
    var column = notificationData.getColumn() - 1;
    var virtualFile = notificationData.getFilePath() != null
                      ? findLocalFileByPath(notificationData.getFilePath())
                      : null;

    var buildIssueNavigatable = exception instanceof BuildIssueException
                                ? ((BuildIssueException)exception).getBuildIssue().getNavigatable(project)
                                : null;
    final Navigatable navigatable;
    if (!isNullOrNonNavigatable(buildIssueNavigatable)) {
      navigatable = buildIssueNavigatable;
    }
    else if (isNullOrNonNavigatable(notificationData.getNavigatable())) {
      navigatable = virtualFile != null ? new OpenFileDescriptor(project, virtualFile, line, column) : NonNavigatable.INSTANCE;
    }
    else {
      navigatable = notificationData.getNavigatable();
    }

    final Notification notification;
    if (group == null) {
      notification = new Notification(externalSystemId.getReadableName() + " build", notificationData.getTitle(),
                                      notificationData.getMessage(),
                                      notificationData.getNotificationCategory().getNotificationType())
        .setListener(notificationData.getListener());
    }
    else {
      notification = group
        .createNotification(notificationData.getTitle(), notificationData.getMessage(), notificationData.getNotificationCategory().getNotificationType())
        .setListener(notificationData.getListener());
    }

    final FailureImpl failure;
    if (exception instanceof BuildIssueException) {
      var buildIssue = ((BuildIssueException)exception).getBuildIssue();
      failure = new FailureImpl(buildIssue.getTitle(), notificationData.getMessage(), Collections.emptyList(), exception, notification,
                                navigatable);
    } else {
      failure = new FailureImpl(notificationData.getMessage(), exception, notification, navigatable);
    }
    return new FailureResultImpl(Collections.singletonList(failure));
  }
private static @NotNull FailureResultImpl createFailureResult(
    @NotNull Throwable exception,
    @NotNull ProjectSystemId externalSystemId,
    @NotNull Project project,
    @NotNull ExternalSystemNotificationManager notificationManager,
    @NotNull NotificationData notificationData
  )