How to add an exception filter to build tab?

Answered

Hi, I added an MyExcetionFilter by implements JvmExceptionOccurrenceFilter and implemented the applyFilter() function. But I noticed that the filter works in run tab, it won't work in the build tab. Because I also want to get the exceptions while building, how to do that?
Thank you very much for any help!

0
1 comment

Hi,

As far as I can see, it should work in the build console too. I set a breakpoint in com.intellij.execution.filters.ExceptionFilters#getFilters(Project, GlobalSearchScope) and in an example Gradle build script loaded in the running IDE, I throw an exception, just to invoke console filters:

try {
 throw IllegalStateException("Controlled exception2")
} catch (e: Exception) {
 e.printStackTrace()
}

Then I triggered reloading the Gradle config, which opens the build tool window with the console.

The debugger stopped in the mentioned place, which collects filters, including com.intellij.execution.filters.AdvancedExceptionFilter, which executes JvmExceptionOccurrenceFilter.

I suggest debugging why it doesn't work in your case.

0

Please sign in to leave a comment.