Search code examples
blackberryjava-metry-catchthrowable

Catching Throwable in Blackberry Java: Good Idea?


I often see catch clauses for Throwable in Blackberry documentation, such as the Network API docs. My sense is that this is not generally a good practice in Java.

Is there a reason for this in Blackberry programming?

Does it have to do with stack trace generation for Throwables?


Solution

  • When you catch Throwable in a BlackBerry app, not only does it preserve the stack trace, it saves that stack trace in the device event log. There is no way for an app to get a stack trace itself, so unfortunately you can't automatically collect stack traces.

    To view the stack trace, you pull up the event log viewer. For blackberries with physical keyboards, hold 'Alt' and then press L G L G to bring up the event log.