Use more modern try/except syntax