From 0e8164cfcf68978a01a5d8e7b8c1b8aff908a093 Mon Sep 17 00:00:00 2001 From: Alex Abashev Date: Sun, 8 Nov 2026 14:05:39 +0300 Subject: [PATCH] Send the IDE plugin's errors to the JetBrains Marketplace The IDE puts an error down to the plugin when its stack trace runs through the plugin's classes, and the plugin named no error handler, so nothing could report one. It now names JetBrainsMarketplaceErrorReportSubmitter, and the reports go to the Exceptions tab of the plugin's page on the JetBrains Marketplace. That submitter is an ITNReporter, whose errors a release IDE does not show, as it does not show its own: the red indicator and Report appear only in EAP builds. From a release IDE a report goes only when the user lets the IDE send error reports automatically, which 2024.2 cannot do. The formatter failing to run, the error worth reporting, was logged as a warning and so never reached a report; it is an error now. A syntax error in the file is a warning now: it is the user's, not the plugin's. --- .../intellij/PalantirJavaFormatFormattingService.java | 8 +++++--- .../src/main/resources/META-INF/plugin.xml | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/open-java-format-idea-plugin/src/main/java/com/palantir/javaformat/intellij/PalantirJavaFormatFormattingService.java b/open-java-format-idea-plugin/src/main/java/com/palantir/javaformat/intellij/PalantirJavaFormatFormattingService.java index 82f13ca31..58d53559f 100644 --- a/open-java-format-idea-plugin/src/main/java/com/palantir/javaformat/intellij/PalantirJavaFormatFormattingService.java +++ b/open-java-format-idea-plugin/src/main/java/com/palantir/javaformat/intellij/PalantirJavaFormatFormattingService.java @@ -150,7 +150,8 @@ public void run() { request.onTextReady(formattedText); } } catch (FormatterException e) { - logger.error( + // A syntax error in the file, not a fault of the plugin: an error would go to its error reports. + logger.warn( String.format( "Failed to format file %s", request.getContext().getContainingFile().getName()), @@ -163,8 +164,9 @@ public void run() { throw e; } catch (RuntimeException e) { // Typically the formatter's JVM failing to start or exiting with an error. Left alone, the IDE - // swallows it and Reformat looks as if it did nothing. - logger.warn("open-java-format could not run the formatter", e); + // swallows it and Reformat looks as if it did nothing. An error rather than a warning, so that it goes + // to the plugin's error reports on the JetBrains Marketplace (see errorHandler in plugin.xml). + logger.error("open-java-format could not run the formatter", e); request.onError( Notifications.GENERIC_ERROR_NOTIFICATION_GROUP, Notifications.formatterFailedMessage( diff --git a/open-java-format-idea-plugin/src/main/resources/META-INF/plugin.xml b/open-java-format-idea-plugin/src/main/resources/META-INF/plugin.xml index dbb6a570a..a4a5bf339 100644 --- a/open-java-format-idea-plugin/src/main/resources/META-INF/plugin.xml +++ b/open-java-format-idea-plugin/src/main/resources/META-INF/plugin.xml @@ -33,6 +33,11 @@ + +