The beauty of descriptive error messages

Recently I’ve been doing some contracting work for a friend.  The project is pretty simple, but it gives me a reason to finally play with Mono’s sqlite database engine.  It’s actually really cool, and I’m very happy to say that it works extremely well on Windows + Visual Studio.  Normally my IDE of choice is MonoDevelop, but the project requires me to read information from an excel spreadsheet, which is not a very easy thing to do if you don’t actually have Microsoft Excel installed on your computer.  But anyways, it’s no problem, that’s where VirtualBox comes to the rescue.

But, that’s not really the point of this whole message.  The point of this entire post is to let people know how important it is to write descriptive error messages.  I was doing some stuff with a few records, and kept getting this exception:

SQL logic error or missing database

I was a bit confused by that.  I checked the actual database, and it was still there.  Sql logic error?  Where is the logic error in “INSERT INTO ….”?  After a bit of searching, I found out that sqlite actually uses this error message for just about everything!  The problem with my code is I was trying to insert records into the table that already had a record with the same primary key.  So, why can’t they write that instead of something so generic it could really mean just about anything?

You can follow any responses to this entry through the RSS 2.0 feed. Responses are currently closed, but you can trackback from your own site.

Comments are closed.