Tag Archives: exceptions

Good Error Messages Can Be Easy

Here is an error message I encountered one day.  It is frustrating, because obviously the code was checking something, but it is frustrating because you get no real clues what the problem really was, and a simple change would make … Continue reading

Posted in Coding, Example Code, Poor Error Msg | Tagged , , , , , | Leave a comment

What is wrong with this code?

It is code review time, and I offer a sample of Java code for you to critique.   Can you find the problems?

Posted in Coding | Tagged , , , | Leave a comment

Ultimate Java Exception Class

This is the third in a series about translatable exceptions (see Translatable Error Messages).  This post is about the class JSONException which contains the required features.

Posted in Coding, Design, Uncategorized | Tagged , , , | Leave a comment

Exception Receiving

When you make a web service call, you want to report the problem to the user save as you do for any other part of the program, and that is through an exception object.  This post talks about converting the … Continue reading

Posted in Coding, Design | Tagged , , , | 1 Comment

Variable Arguments for Messages

We need to construct an object which has a template and a set of parameter data values.  Java offers a couple of ways to do this, and this post shows how the variable parameter mechanism works easily and conveniently for … Continue reading

Posted in Coding, Design, Uncategorized | Tagged , , , | 1 Comment

JSON Translatable Error Messages

Second in a series on translatable exceptions, this discusses how an error message should be returned as JSON from a web-service API so that it the calling program can display the error in the right language for the user.

Posted in Coding, Design, Uncategorized | Tagged , , , | 2 Comments

Translatable Error Messages

This is the first of a series of posts, I want to go over some of the groundwork of what it takes to make exceptions localizable into other languages. Nothing new here, but just want to explain clearly the requirements … Continue reading

Posted in Coding, Design, Uncategorized | Tagged , , | 3 Comments

Constants and Errors

Still reviewing that code base and finding more bad patterns for use of constants, this time for error messages.   This is another “don’t do this” post.

Posted in Coding, practice, Uncategorized | Tagged , , , | Leave a comment

Pragmatic Exception Handling

If you already know the requirements and best practices for exception handling and error reporting, this post talks about some convenient guidelines to follow to make it easier to comply with the rules.

Posted in Coding | Tagged , | Leave a comment

Context Error Reporting

One of the biggest mistakes I see programmers make when writing an error message is to forget to include details about the context into the message.  The message effectively “assumes” that the reader knows the context, but that assumption is … Continue reading

Posted in Coding, Design, Poor Error Msg | Tagged , , , , | Leave a comment