[haXe] Re: rethrown exception

Franco Ponticelli franco.ponticelli at gmail.com
Mon Apr 10 11:47:34 CEST 2006


I've seen that the exception is rethrown (in JS) if there is not a catch all
statement.
Another matter is that the catch all statement is always executed, also if a
previous catch has treated the exception; should the catch chain be in the
form of if(){...}else if(){...}else{...}?

2006/4/10, Franco Ponticelli <franco.ponticelli at gmail.com>:
>
> I've this code in haXe:
>
>     public function testAssert() : Void
>     {
>         try
>         {
>             Assert.isTrue(false, null);
>         }
>         catch(e : xUnit.AssertionException)
>         {
>             trace(e);
>             Assert.isTrue(true, null);
>         }
>     }
>
> which compiles this way in JS:
>
> xUnit.TestCaseAssert.prototype.testAssert = function() {
>     try {
>         xUnit.Assert.isTrue (false,null);
>     }
>     catch( $e ) {
>         var e = $e;
>         if( js.Boot.__instanceof($e,xUnit.AssertionException) ) {
>             Log.trace(e,{ methodName : "testAssert", className : "
> xUnit.TestCaseAssert ", lineNumber : 25, fileName : "TestCaseAssert.hx"});
>             xUnit.Assert.isTrue(true,null);
>         }
>         throw($e);
>     }
> }
>
> Why the exception is automatically rethrown? Is there a way to prevent
> this? In flash the exception is captured and not rethrown ... at leas I
> think so ...
>
> Thank you,
> Franco.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20060410/b6a22332/attachment.htm


More information about the Haxe mailing list