問題文
A custom exception should report the low level failure that led to it. What is the recommended way to carry that information?
選択肢
- Provide a constructor that takes a message and a Throwable cause, and pass the original exception as that cause when wrapping it.
- Extend the original exception class so that catching the custom type also catches the original one.
- Put the text of the original exception into the message, while the original object itself is not retained.
- Store the original exception in a static field of the custom exception class so that any handler anywhere in the application can reach it without extra plumbing.