class 1:
public static void TypeOneException2TypeTwoException(TypeOneException exception)
throws TypeTwoException {
if (exception == null)
throw new IllegalArgumentException(
"TypeOneException shouldn't be null");
LOG_SERVICE.debug(exception.getMessage(), exception); //log it
if (exception instanceof TypeTwoException)
throw new TypeTwoException(
DavServletResponse.SC_METHOD_NOT_ALLOWED,
exception.getMessage());
class 2:
public void callerOne(){
try{
}catch(TypeOneException exception){
LOG_SERVICE.debug(exception.getMessage(), exception); //is still need log it? any benifit?
TypeOneException2TypeTwoException(exception)
}
class 3:
public void callerTwo(){
try{
}catch(TypeOneException exception){
LOG_SERVICE.debug(exception.getMessage(), exception); //is still need log it?
TypeOneException2TypeTwoException(exception)
}
class 4:
public void callerTwo(){
try{
}catch(TypeOneException exception){
LOG_SERVICE.debug(exception.getMessage(), exception); //is still need log it?
TypeOneException2TypeTwoException(exception)
}
タイトル通り。class1 にエラーを記録しました。発信者 (class2,3,4) にログインする必要がある場合は? 必要に応じて、メリットはありましたか? 前もって感謝します。重複したコードが存在する場合、必要だと思われますか?