item 73) 추상화 수준에 맞는 예외를 던지라
예외 번역(exception translation)
try {
...// 저수준 추상화를 이용한다.
} catch (LowerLevelException e) {
throw new HigherLevelException(...);
}예외 연쇄(exception chaining)
try {
...// 저수준 추상화를 이용한다.
} catch (LowerLevelException cause) {
throw new HighetLevelException(cause);
}
class HigherLevelException extends Exception {
//고수준 예외 연쇄용 생성자HigherLevelException(Throwable cause) {
super(cause);
}
}정리
Last updated