Replace try/catch with case