conditionally adding an errorReporter 关注
Has anybody ever tried to use the ExtensionPoint API to register a ExtensionPoints.ERROR_HANDLER_EP?
I'm finding that this fails because the ExtenstionPoint.registerExtension code uses an ObjectComponentAdapter that doesn't properly initialize the PluginDescriptor, which is used in the IdeErrorsDialog to determine if it's the right reporter to use.
I've messed around with various other APIs including ExtensionArea and CoreApplicationEnvironment to no avail.
I'd love to hear it if someone knows of a correct way to do this.
firstly why do you want to register errorHandler conditionally? Note that this extension is used to report uncaught exceptions thrown by the IDE via
'IDE Fatal Errors' dialog, and errorHandler of your plugin will be called only if the stacktrace contains classes from your plugin.
Anyway PluginDescriptor is set only for extension loaded from plugin.xml indeed. If you want to register the extension in java code, you can invoke
setPluginDescriptor method by hand and pass PluginManager.getPlugin to it.
"Develop with pleasure!"
Thank you! This worked.
Our use-case is a bit weird. We only want to report to our backend from IJ but not from AS.