Gracefully handling when the db cannot connect

This should fix the build as well.