Error Handling

I found this actual error message today while working with a vendor application:


Okay, it wasn't that exact error message. And that's my code. BUT, the first part is verbatim.

This is a server-side, vendor-provided, and above all, released product. This is not a beta; we paid someone to give us that error message.

What am I supposed to do with that message. My code called your code and it told me "Unable to get resources." Guess I'll just take a nap till those resources can be gotten.

Over the years I have seen both vendor applications and custom code where programmers are throwing away valuable information by not properly sending errors up the stack.  

You should always, always, ALWAYS send your errors up the stack! *

The error above could easily have been something like this:


See, now I know something! This is a java.lang.NullPointerException exception in the file MeaningfulError.java - on line 11. That's an informative and actionable message. 

If you do not do this, you are essentially stealing time from the future. It'd be like if someone 

For software APIs and cloud provided services, I believe this is so important that it should warrant it's own set of unit, integration, and functional tests. Adding this to your regression tests will help prevent your customers ending up in an information void. 

* The only possible exception is a UI programmer. Even then, it should only be after careful consideration of how to display the error on the UI and properly log the error. 




Comments

Popular posts from this blog

Integrated Windows Authentication with Chrome and Firefox

Impressions from the Past