Add error handler for database connect