by: Nikolay Krasko

Ability to report exceptions from non-bundled JetBrains plugins in development mode even if platform build is in release mode.
This commit is contained in:
Maxim Shafirov
2012-06-19 20:06:06 +04:00
parent 07bb170e84
commit a586543943
2 changed files with 17 additions and 2 deletions
@@ -21,6 +21,7 @@ import com.intellij.notification.NotificationType;
import com.intellij.notification.Notifications;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.diagnostic.ErrorLogger;
import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.util.io.MappingFailedException;
@@ -43,8 +44,11 @@ public class DefaultIdeaErrorLogger implements ErrorLogger {
public boolean canHandle(IdeaLoggingEvent event) {
boolean notificationEnabled = !DISABLED_VALUE.equals(System.getProperty(FATAL_ERROR_NOTIFICATION_PROPERTY, ENABLED_VALUE));
ErrorReportSubmitter submitter = IdeErrorsDialog.getSubmitter(event.getThrowable());
boolean showPluginError = !(submitter instanceof ITNReporter) || ((ITNReporter)submitter).showErrorInRelease(event);
return notificationEnabled ||
!(IdeErrorsDialog.getSubmitter(event.getThrowable()) instanceof ITNReporter) ||
showPluginError ||
ApplicationManagerEx.getApplicationEx().isInternal() ||
isOOMError(event.getThrowable()) ||
event.getThrowable() instanceof MappingFailedException;
@@ -26,7 +26,9 @@ import com.intellij.ide.DataManager;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.ide.plugins.PluginManager;
import com.intellij.idea.IdeaLogger;
import com.intellij.notification.*;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.notification.NotificationType;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.ApplicationInfo;
@@ -72,6 +74,15 @@ public class ITNReporter extends ErrorReportSubmitter {
return sendError(events[0], additionalInfo, parentComponent, consumer);
}
/**
* Could be used to enable error reporting even in release versions from non-internal mode.
* @return false by default.
*/
@SuppressWarnings({"MethodMayBeStatic", "UnusedParameters"})
public boolean showErrorInRelease(IdeaLoggingEvent event) {
return false;
}
/**
* @noinspection ThrowablePrintStackTrace
*/