Advertisement
Guest User

Untitled

a guest
Oct 4th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1.     int code = 4;
  2.     Exception ex;
  3.     try{
  4.        load0(res0);
  5.        someCodeHere();
  6.        load1(res1);
  7.        someOtherCodeHere();
  8.        load2(res2);
  9.        yetAnotherCodeHere();
  10.        load3(res3);
  11.        andYetAnotherCodeHere();
  12.     }
  13.     catch(EType0 e0){
  14.         code = 0;
  15.         ex = e0;
  16.     }
  17.     catch(EType1 e1){
  18.         code = 1;
  19.         ex = e1;
  20.     }
  21.     catch(EType2 e2){
  22.         code = 2;
  23.         ex = e2;
  24.     }
  25.     catch(EType3 e3){
  26.         code = 3;
  27.         ex = e3;
  28.     }
  29.     switch(code){
  30.         case 4:
  31.             unload3(res3);
  32.         case 3:
  33.             unload2(res2);
  34.         case 2:
  35.             unload1(res1);
  36.         case 1:
  37.             unload0(res0);
  38.         case 0:
  39.             break;
  40.     }
  41.     if(code < 4)
  42.         throw new Exception("whatever happens lol", ex);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement