Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 242
Registered: ‎02-19-2013
My Device: 9500
My Carrier: _

Convert the e.printstacktrace to string

I want to get the error trace in string variable. How can i do it in blackberry.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Convert the e.printstacktrace to string

AFAIK you can't sorry.  The only place it can be put is in the log. 

 

And in order to get a strack trace, you have to chatch Throwable.  Catching an Exception throws away the stack trace.

 

Here is sample code to get a stack trace.

 

      try {
      } catch (Throwable t) {
       t.printStackTrace();
       System.out.println("Throwbable: " + t.toString());
      }

Developer
Posts: 242
Registered: ‎02-19-2013
My Device: 9500
My Carrier: _

Re: Convert the e.printstacktrace to string

It give me name of exception rather than complete exception.

 

Could you help to get the complete exceptin like line no , in which class exception occur and exception and name.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Convert the e.printstacktrace to string

Sorry, the stack trace is the only way to get that, and as noted, it is only captured when you catch Throwable, and you can't get the stack trace in a String in your application, just in the log.