Additional Error handling for db modules

This should also address the issue in #1018 
checking it out on staging now