[Laszlo-dev] Is this compiled code for a method, in debug, mode, correct?
P T Withington
ptw at pobox.com
Mon Sep 21 13:26:23 PDT 2009
To elaborate a little more on André's comment:
$lzsc$thrownError is an error that was thrown from a block where
`#pragma "throwsErrors=true" was used to _prevent_ reporting (and
catching) of the error. (I refer to this as "guarding" the error
below.)
So, if the error we catch matches that "guarded" error, we _don't_
report it, we just immediately re-throw it. Any other error would
mean that the error is _not_ guarded (either it is the original error,
or it superseded a guarded error), so that error _will_ be reported by
the debugger (and then fall through and be re-thrown).
There is a slight inefficiency here. The debugger uses a separate
memo to avoid re-reporting unguarded errors, but we could optimize
that by, once the debugger has reported the error, then setting $lzsc
$thrownError to the reported error, to avoid recalling the exception
code as the error percolates up the stack.
On 2009-09-21, at 15:11, André Bargull wrote:
> The error is only discarded if "catcherrors" is enabled (and the
> "throwsError" pragma isn't used).
>
>> I was looking at the as3 generated code for an onclick handler
>> which came
>> from this source code
>>
>> <button onclick="canvas.test(1)">click me </button>
>>
>> It looks like this, when compiled in debug mode
>>
>> public function $lzc$handle_onclick$$args$2Elzx_11_41_$m492 ($lzc
>> $ignore_$1)
>> {
>> try {
>> canvas.test(1);
>> }
>> catch ($lzsc$e) {
>> if ($lzsc$e is Error) {
>> if (lz["$lzsc$thrownError"] === $lzsc$e) {
>> throw $lzsc$e;
>> };
>> $lzsc$runtime.reportException("args.lzx", 11, $lzsc$e);
>> };
>> throw $lzsc$e;
>> }
>> }
>>
>> If some error is thrown in the call to "test", this wrapper looks
>> like it
>> will always catch and then
>> rethrow it. Is this the expected behavior? I sort of thought we
>> were going
>> to catch and report the error
>> to our debugger, and then discard it rather than rethrowing it, in
>> this case
>> (debugger on)?
>>
>> --
>> Henry Minsky
>> Software Architect
>> hminsky at laszlosystems.com <http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>> >
>>
>
More information about the Laszlo-dev
mailing list