better error handling for db connection issues