在一些遗留代码中,我看到这个,一个过度广泛的异常被捕获,然后再次抛出,这是一个好习惯吗?throw e;
是重新抛出相同的异常,还是创建一个新异常?
catch (Exception e) {
StringBuilder sb = new StringBuilder(
"Oops. Something went wrong with id: ");
sb.append(id);
sb.append(". Exception is: ");
sb.append(e.toString());
System.out.println(sb.toString());
throw e;
}