added error handlers for failed db connection