개발1 try-catch만 쓰면 안되는 이유 개발을 하다보면 try-catch를 이용해 에러를 잡곤 한다.그러나 try-catch만으로는 부족하다.try { int result = await DatabaseHelper.instance.insertItem(newItem); if (result > 0) { _showSuccessDialog(); } else { _showFailDialog(); }} catch (e) { print("에러 발생: $e"); _showFailDialog();} 데이터베이스에 newItem을 넣는 과정을 챗GPT 시켜서 짜게 했는데 이런 코드를 주었다.어차피 try-catch에서 에러를 잡을텐데 왜 굳이 result > 0을 확인하는지 궁금해졌다.이유를 물어보니 다음과 같이 답을 주었다.✅ if (re.. 2025. 3. 21. 이전 1 다음