How to detect SQL execution errors (e.g. syntax errors) in a DataGrip plugin?

Hi everyone,
I’m developing a plugin for DataGrip that enhances SQL workflows. One of the features we want to implement is detecting when a user runs an invalid SQL query (like a syntax error).

We’ve tried several approaches—listening to logs, analyzing execution flows, and looking through available extension points, but haven’t found a reliable way to catch and retrieve these SQL execution errors.

Has anyone managed to hook into this part of DataGrip or found a workaround to capture such errors during execution?

Any guidance or examples would be greatly appreciated!
Thanks in advance :folded_hands: