Subject: | Perl exceptions from bound JS constructors do not propagate |
Date: | Tue, 10 Apr 2007 01:13:11 -0700 |
To: | bug-JavaScript [...] rt.cpan.org |
From: | "Jesse Thompson" <jesset [...] gmail.com> |
I am using JavaScript v1.03 with Perl v5.8.4 on Linux kernel
2.4.27-2-386 running Debian sarge (JavaScript.pm compiled against
Spidermonkey 1.60 straight from Mozilla, not from Debian packaged
version).
It appears as though Perl exceptions (such as 'die' statements or run
time errors) that occur while running a subroutine bound as a JS
constructor do not propagate to JS level as an exception.
If such a "Perl exception" happens during a JS method (object or
static) instead however, the error propagates as expected.
Attached is a test case. Run as is, the diagnostic displays a blessed
object. when you uncomment "test point 2" you get a well documented
error message. When you uncomment "Test point #1" however, the message
goes unreported and you get a blank (uncontructed) object instead of a
blessed hash.
Suggested workarounds prior to fix:
If appropriate, a developer may arrange to have his JavaScript forgo
formal constructors and simply call methods right after construction
to accomplish the needed housekeeping.
- - Jesse Thompson
Webformix, Bend OR
Message body is not shown because sender requested not to inline it.