Issue #248 - improved database error handling.
Merge pull request #251 from nwinklareth/master

Issue #248 - improved database error handling.