• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error messages  RSS feed

 
svein kristian nykaas
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Not sure if this is the right place to post, but it was the closest thing I could find.

I am wondering, what are good "Error message" when an exception hit? Is there some kind of standard for this? For example; say your entire program is developed around there being allot of images in a folder called images, then someone goes about to delete a few of said images, so an exception occurs informing him on this the next time he tries to run the program. What would be the most appropriate error message for such a scenario?
 
Anayonkar Shivalkar
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello svein kristian nykaas,

Welcome to CodeRanch!

I'm not sure if there is any standard for such thing, but a good error message is something which tells user (i.e. the one who reads the log) that what is severity of this error, what exactly is happening (and sometimes) what can be done to avoid bad scenarios.

Now, coming to your question, I did not get what you are trying to accomplish. e.g. if a folder contains 10 images and I delete 3 of them, how would your program, at first place, would know that there were 10 images and 3 are deleted? If the program cannot figure this out, then there's no point in thinking about error message.

Again, what further action do you want to take will totally depend on what kind of program you are writing. e.g. if you are writing a photo management software (like f-spot, digikam etc.), then you might store names and checksums of those files in a DB, and afterwords, if someone deletes those images from outside your software, the code can understand the discrepancy between DB and actual file system and throw a warning. In this scenario, I don't think you should simply exit the program. Again, the action depends on what you are exactly doing.

I hope this helps.
 
svein kristian nykaas
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was more or less thinking of images in a game or something similar(where every image is an extremely important thing for certain areas of the game, so if you lack say the whole image of a cave, then the game wouldn't be able to continue at all, which would make an error appropriate) in that example.

Thanks allot for you answer! But the error-message itself, as in the message-box itself, what kind of message would be better suited to use there? If we take the above example would it be good to have say; "Image # can not be found in [folder]"? or would something like "Unable to read data, error code:#" Be better?
 
Anayonkar Shivalkar
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would suggest a message something like : Image <image_name> cannot be found. Please contact <contact_details>.

The later part is because the user (i.e. game player) must know what to do next. You can also add instructions like if reinstalling the game would fix the issue etc. The detailed description should be in troubleshooting guide, and your exception message should contain index id of that topic from guide (e.g. refer topic # from troubleshooting guide located at <location>).

I hope this helps.
 
svein kristian nykaas
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I'll be sure to do that .
 
Anayonkar Shivalkar
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are Welcome
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!