• Post Reply Bookmark Topic Watch Topic
  • New Topic

Handling Exceptions  RSS feed

 
Jim Branley
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello There Scouts,

Long time no see.
I've been busy driving a herd of data from Bit Cliff, Montana to Compile Creek, New Mexico.
The trip went well with the exception of a few thunderstorms that took out our power supply.
Speaking of exception I have a simple question regarding exception handling and was wondering if someone can lend a hand.
The text book that I am using has an example of a program that handles exceptions with a 'Try' and 'Catch' statement. It works well however in the environment in which I am writing the code in 'JGrasp' down in the I/O window it prints out a few lines of slimy green messages. I know the user won't see these messages but I was wondering if there was something that I could write in the code that would keep those messages from appearing? I admit that this is a dumb question but dumb questions is how the wheel was invented. Just ask my grandpa.

Thanks,
Jim
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are those messages? Presumably something that gets written in the catch block? Informing a user of serious problems is good; maybe a better way would be not to print to the standard output, but to open a little Swing dialog (assuming this is a desktop app) showing it. Something like a JOptionPane.
 
Jim Branley
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:What are those messages? Presumably something that gets written in the catch block? Informing a user of serious problems is good; maybe a better way would be not to print to the standard output, but to open a little Swing dialog (assuming this is a desktop app) showing it. Something like a JOptionPane.


These messages are not printed for the user to see, just the coder. They're in the IDE. I am not too worried about it though. I understand that it is telling the coder the error.

Thank you,
Jim
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if you told us what those message are we might make suggestion on how to suppress them altogether.
 
Larry Barowski
Greenhorn
Posts: 4
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim Branley wrote:These messages are not printed for the user to see, just the coder. They're in the IDE. I am not too worried about it though. I understand that it is telling the coder the error.


It sounds like you are talking about uncaught exception stack traces, which jGRASP shows in green by default. Those will be printed outside the IDE, in the shell if the user launches your program from some sort of command shell, or in the system console, Java console of the browser, etc. In general, your goal should be to not have any uncaught exceptions.
 
Rafael Prado Oliveira
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
paste the error and code we might be able to help..

Remember to use the code tags!!!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!