Added database errors check
Merge pull request #35 from siddharthg/master

Added database errors check