Mega Code Archive

 
Categories / Flash ActionScript / Statement
 

Throws an exception in a finally block

package{   import flash.display.Sprite;      public class Main extends Sprite{     public function Main(){         try {           throwTwoExceptions(  );         } catch (e:Error) {           trace("External catch: " + e.message);         }                  try {           throw new Error("Test error 1");         } finally {           try {             throw new Error("Test error 2");           } catch (e:Error) {             trace("internal catch: " + e.message); // Never executes because                                                    // the types don't match.           }         }     }     public function throwTwoExceptions (  ):void {       try {         throw new Error("Test error 1");       } finally {         try {           throw new Error("Test error 2");         } catch (e:Error) {           trace("Internal catch: " + e.message);         }       }     }   } }