Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Or you can use chained error messages.

Unable to create the media database. Failed to upgrade the database from version 3 to version 6. SQL Query failed. Syntax error at column 29 near "wehre". ("SELECT id`Thumbnail from tThumbailIndex wehre idFile=?").

(Messages are pre-pended to inner errors as one progresses up the stack). Yes, a gruesome error message. But it's a gruesome error condition.

I've also used inner exceptions in a large Enterprise product, and was very pleased with the result. (Java has them, .net has them, C++ and Typescript can have them if you want them). At the top level, the error message goes:

   Unable to connect to the media database.

   Failed to upgrade from version 3 to version 6. 

   SQL Query error failed.

   Syntax error at column 6 near 'ndex.

   ("SELECT idI'ndex from T_ThumbnailIndex")
(each successive error message contained in a successive inner exception). The advantage: no need to assemble multiple lines of logged errors from a logfile that end-users really don't want to be digging around in.

A more prosaic and actually end-user-helpful chained message might be:

   Unable to connect to the media database.

   Failed to create the file /var/MediaServer/mediaIndex.db

   Out of disk space.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: