아이템 73. 추상화 수준에 맞는 예외를 던지라 #172
Unanswered
Irisation23
asked this question in
3. 과제
Replies: 1 comment
-
잘 봤습니다~! 이 책에서 "추상화 수준에 맞는 예외로 바꿔 던지는 것" 을 번역(translation)이라고 번역한 것과, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
📝 구성
Table of contents generated with markdown-toc
0. TL;DR 📚
1. 잘못 처리된 예외
2. 예외 번역(Exception Translation)
위와 같은 상황에서의 해결책으로 제시 될 수 있는 방법이다.
예외 연쇄(exception chanining)
을 사용하는게 좋다.3. 예외 연쇄(exception chanining)
문제의 근본 원인(cause)인 저수준 예외를 고수준 예외에 실어 보내는 방식이다.
우수한 방법
이지만 남용해서는 안된다.상위 계층 메서드
의 매개변수 값을 아래 계층 메서드로 건내기 전에 미리 검사하는 방법으로 목적을 달성할 수 있다.(아이템 49. 매개변수가 유효한지 검사하라 #114 )3.1 차선책
4. 최종 정리 📚
그래서 추상화 수준에 맞는 예외는 무엇일까? 🤔
예외 번역
과예외 연쇄
를 고려한 예외의 처리이다.예외 번역
은 저수준 예외를 처리하고 있는 자신(this) 수준에 맞는 예외로 바꿔 던지는 것이다.예외 연쇄
는 문제의 원인(cause) 저수준 예외를 고수준 예외에 실어 보내는 방식이다.5. 회고 🧹
2023-03-26 일
Beta Was this translation helpful? Give feedback.
All reactions