Throws an exception in a finally block. : Finally : Statement Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Statement » Finally »

 

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);
        }
      }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Statement
» Finally