How do i catch unchecked exceptions in SWT's event-loop
i guess the question is pretty clear, i want to catch (and log) RuntimeException that occur i开发者_Go百科n SWT's event-loop. Right now i'm wrapping all my calls to code in a Runnable which logs any RuntimeException, but this has drawbacks like adding a lot of boilerplate-code and not being able to catch exceptions in third-party gui-libraries.
You can create an UncaughtExceptionHandler
that will be called when an exception is thrown and not caught somewhere in the code. This allows you do to the last minute logging you want to achieve. Here is a more detailed article that shows how you can use the handler.
精彩评论