开发者

How do i catch unchecked exceptions in SWT's event-loop

开发者 https://www.devze.com 2023-03-29 06:40 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号