private static @Nullable NotificationData doCreateNotification(
    @NotNull @NotificationTitle String title,
    @NotNull Throwable error,
    @NotNull ProjectSystemId externalSystemId,
    @NotNull Project project,
    @NotNull DataContext dataContext,
    @NotNull BiConsumer<ExternalSystemNotificationExtension, NotificationData> customise
  ) {
    if (isInternalError(error, externalSystemId)) {
      return null;
    }

    String message = ExternalSystemApiUtil.buildErrorMessage(error);
    NotificationCategory notificationCategory = NotificationCategory.ERROR;
    String filePath = null;
    Integer line = null;
    Integer column = null;

    Throwable unwrapped = RemoteUtil.unwrap(error);
    if (unwrapped instanceof LocationAwareExternalSystemException locationAwareExternalSystemException) {
      filePath = locationAwareExternalSystemException.getFilePath();
      line = locationAwareExternalSystemException.getLine();
      column = locationAwareExternalSystemException.getColumn();
    }

    NotificationData notificationData =
      new NotificationData(
        title, message, notificationCategory, NotificationSource.PROJECT_SYNC,
        filePath, ObjectUtils.notNull(line, -1), ObjectUtils.notNull(column, -1), false);

    if (unwrapped instanceof BuildIssueException) {
      BuildIssue buildIssue = ((BuildIssueException)unwrapped).getBuildIssue();
      for (BuildIssueQuickFix quickFix : buildIssue.getQuickFixes()) {
        notificationData.setListener(quickFix.getId(), (notification, event) -> {
          quickFix.runQuickFix(project, dataContext);
        });
      }
      notificationData.setNavigatable(buildIssue.getNavigatable(project));
      return notificationData;
    }

    for (ExternalSystemNotificationExtension extension : ExternalSystemNotificationExtension.EP_NAME.getExtensions()) {
      final ProjectSystemId targetExternalSystemId = extension.getTargetExternalSystemId();
      if (!externalSystemId.equals(targetExternalSystemId) && !targetExternalSystemId.equals(ProjectSystemId.IDE)) {
        continue;
      }
      customise.accept(extension, notificationData);
    }
    return notificationData;
  }
private static @Nullable NotificationData doCreateNotification(
    @NotNull @NotificationTitle String title,
    @NotNull Throwable error,
    @NotNull ProjectSystemId externalSystemId,
    @NotNull Project project,
    @NotNull DataContext dataContext,
    @NotNull BiConsumer<ExternalSystemNotificationExtension, NotificationData> customise
  )