异常处理(八)
1 public void func1() throws Exception1 { 2 // ... 3 } 4 5 6 public void func2() throws Exception2 { 7 //... 8 try { 9 func1(); 10 } catch(Exception1 e) { 11 throw new Exception2("...", e); // wrap成新的Exception2然后re-throw 12 } 13 //... 14 }
1 public void func1() throws Exception1 { 2 // ... 3 } 4 5 6 public void func2() throws Exception2 { 7 //... 8 try { 9 func1(); 10 } catch(Exception1 e) { 11 throw new Exception2("...", e); // wrap成新的Exception2然后re-throw 12 } 13 //... 14 }