Friday, February 8, 2008

CoreException anit-pattern

Hello there

I have run recently into bug 212340. There is described anti-pattern that causes stack trace to vanish.

The explanation is quite easy - currently StatusManager#handle accepts IStatus, and CoreException has getStatus method... So it is almost reflex action to write:
StatusManager.getManager().handle(e.getStatus()); CoreException's stack trace is lost...

So... wrap CoreException in IStatus before passing it to StatusManager!

Regards,
Chris

No comments: