database error handling
Merge pull request #174 from jpecht/master

database error handling