add try except to manage database connection error