Exception 처리에 대해 궁금합니다. (자바)
구조
Controller -> Service -> Mapper -> DB
findService
(코드 띄워쓰기가 안되네요ㅠㅠ)
@Transactional(readOnly = true)
public xxVo findInfo(xxVo xxvo) {
A a = aMapper.find()
if(a == null) throw new Exception(msg, errorCode) -
try {
메서드1
메서드2
} catch (Exception e) {
throw new Exception(msg, errorCode)
}
}
private 메서드1()
private 메서드2()
질문
1. 메서드 하나하나에 Exception 처리를 해도 될까요?
아니면 저렇게 메서드를 통으로 감싸서 try 문을 써도 될지?
2. A a = aMapper.find() 이 부분의 결과값에 따라 exception 쓰는데 괜찮은건지?
3. Exception 처리의 기준에 대해 궁금합니다. 유튜브도 보고 했지만 okky 분들의 의견이 궁금합니다.