imgui-java icon indicating copy to clipboard operation
imgui-java copied to clipboard

Gracefully handling ImGui errors

Open Igrium opened this issue 4 months ago • 1 comments

Is there a way to gracefully handle ImGui assertion errors as a Java exception rather than outright crashing the whole process? I'm working with an exception-based crash handler, and I'd like my crash reports to get generated properly even if the fault lies in UI code.

Igrium avatar Oct 20 '25 19:10 Igrium

From #100:

Due to how ImGui expects execution to end upon an assertion failure, it is not capable of continuing execution after a failed assertion. As such, this implementation will call a System.exit(1) after the user callback has completed. It is not possible to throw an exception to terminate execution as the native call must complete before the exception propagates up the stack to become uncaught and terminate the application. In the event that the callback throws an exception, it is caught and printed with a warning, along with some basic information about the assertion. Please see the javadocs for more information.

serivesmejia avatar Oct 23 '25 20:10 serivesmejia