Closed
Bug 225817
Opened 21 years ago
Closed 21 years ago
Support for fileName/lineNumber properties in Error objects
Categories
(Rhino Graveyard :: Core, enhancement)
Rhino Graveyard
Core
Tracking
(Not tracked)
VERIFIED
FIXED
1.5R5
People
(Reporter: igor, Assigned: igor)
Details
Attachments
(3 files, 1 obsolete file)
10.72 KB,
patch
|
Details | Diff | Splinter Review | |
5.59 KB,
patch
|
Details | Diff | Splinter Review | |
1.07 KB,
patch
|
Details | Diff | Splinter Review |
It would be nice if Rhino would define fileName and lineNumber in error objects as SpiderMonkey does.
Assignee | ||
Comment 1•21 years ago
|
||
Rhino CVS tip already contains code to put fileName and lineNumber properties. I added that code to ScriptRuntime.getCatchObject together with code to create JS Error objects from Java exceptions only when scripts catches exceptions. But it did not help to pass js1_5/Exceptions/regress-50447.js and the patch fixes that so hopefully the patch makes Rhino matching SpiderMonkey behavior.
Assignee | ||
Updated•21 years ago
|
Attachment #135575 -
Attachment is obsolete: true
Assignee | ||
Comment 3•21 years ago
|
||
I committed the fix, but I keep the bug open since I think it would be resonable to add fileName and lineNumber properties to JS objects representing caught Java execptions.
Status: NEW → ASSIGNED
Assignee | ||
Comment 4•21 years ago
|
||
With the patch when I run: try { null.value; } catch (e) { print(format_ex(e)); } try { new java.util.Vector(-1); } catch (e) { print(format_ex(e)); } function format_ex(e) { return e.fileName+":"+e.lineNumber+": "+e.name+": "+e.message; } I get: /tmp/x.js:2: TypeError: Cannot read property "value" from null /tmp/x.js:8: JavaException: java.lang.IllegalArgumentException: Illegal Capacity: -1 The patch adds new exception constructor, JavaException and puts the original java exception as javaException property of the catch object so the following would also works: try { new java.util.Vector(-1); } catch (e if JavaException) { e.javaException.printStackTrace(); }
Assignee | ||
Comment 5•21 years ago
|
||
I commiteed the last patch.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 7•21 years ago
|
||
Thanks, Igor. Patch checked in for rhino-n.tests: [//d/JS_TRUNK/mozilla/js/tests] cvs ci rhino-n.tests Checking in rhino-n.tests; /cvsroot/mozilla/js/tests/rhino-n.tests,v <-- rhino-n.tests new revision: 1.57; previous revision: 1.56 done Marking Verified FIXED. Testcase js1_5/Exceptions/regress-50447.js above now passes in the Rhino shell, in compiled/interpreted modes.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•