Reputation: 7112
I'm using the following line of code in all of my catch statements to print errors to the console:
System.out.println("ERROR MESSAGE " + e.getMessage() );
Sometimes, in the console, I get the following:
ERROR MESSAGE null
How can it be null? If it reaches the catch that means an exception was thrown, but why null?
Upvotes: 5
Views: 350
Reputation: 939
I don't know why it is null, I just suppose that BlackBerry OS and API has a lot of undesired behaviour. I solved this issue by using
e.toString()
as in:
catch (Exception e)
{
System.out.println("Exception caught: " + e.toString());
}
Upvotes: 6