How to avoid red exclamation notification icon controlled by idea.fatal.error.notification property?

I know this title may initially appear unreasonable — how could anyone justify suppressing anomalous information in this manner? Therefore, I’ll clarify why I’m compelled to address this suppression approach.

My plugin provides syntax support for a small language, which it associates with a java or kotlin class via an export statement at the beginning of the file.

Java and Kotlin entities don’t require the same parsing logic, so I need to get the language of the entity, and then do the parsing accordingly.

The image above shows the complete entity fully qualified name extraction logic, with export being one of them… But that’s not important, it’s the fetched package name that counts.

Then there is a problem, whether it is specified by export, or another way to get the full qualified name of the entity, it may be due to an oversight when entering the error, such as writing “cmo.xxx.projcet” and so on, the entityClass will be null. In this case, I give an error level notification and throw an exception to abort the process.

The multiple error message popups due to IDEA’s multiple attempts to get syntax information were in line with my expectations, and I wanted it to be conspicuous enough to make it easier for the user to find out what the problem was - even though it could come up with many, many, super-multiple.

But that ‘IDE error occurred’ at the bottom of those notifications is not something I want to see, that exception is under my control, it’s a meaningful exception, it’s not a problem due to design or implementation error, it shouldn’t be notified to the user in that way, it shouldn’t even be perceived by the user.

I’m looking for help in one of two directions right now:

How to interrupt the process after entityClass in a non-exception way?

How to suppress some kind of exception, like the IllegalStateException I have here?

  • Of course, IllegalStateException has a really large impact, so if I could actually suppress it, I would create a separate exception for this scenario.

It is red only in EAP and gray in release builds nowadays