Closed Bug 95101 Opened 24 years ago Closed 24 years ago

Problem with exception thrown for undefined function with v1.5r2

Categories

(Rhino Graveyard :: Core, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: pschwartau, Assigned: norrisboyd)

Details

Reported by brien.oberstein@transacttools.net: We've noticed behavior that's changed between rhino 1.5r1 and 1.5r2. When calling a function that has not been defined via evaluateString(), the EcmaError that is thrown returns an (incorrect?) value for .getName(). Previously it returned ReferenceError whereas now it returns "undefined". Not sure what the correct value is going strictly by the spec, but it seems like EcmaErrors should probably not be returning 'undefined' in any case.
Confirming bug on WinNT. If I load the Rhino shell, and call a non-existent function "f", here is the output I get in RC1 vs. RC2: RC1 js: "TEST.js", line 40: uncaught JavaScript exception: ReferenceError: "f" is not defined. (TEST.js; line 40) RC2 js: "TEST.js", line 40: uncaught JavaScript exception: undefined: "f" is not defined. (TEST.js; line 40)
However, if I use a try...catch block, the error is correctly caught as a ReferenceError object in Rhino. Therefore the following testcase is passing in both RC1 and RC2 of Rhino: mozilla/js/tests/ecma_3/Exceptions/regress-95101.js
The only way I can see the error is manually in the interactive shell, as described above -
Is there a method on the ReferenceError object that will allow me to see the full error message? As in this pseudo-code: try { fNONEXISTENT(); } catch (e) { e.printFullError(); } Does anything like that exist?
There's e.toString() and e.message.
Fixed: Checking in NativeGlobal.java; /cvsroot/mozilla/js/rhino/src/org/mozilla/javascript/NativeGlobal.java,v <-- N ativeGlobal.java new revision: 1.34; previous revision: 1.33 done
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Improved the testcase above by testing e.toString(). Failed this before the fix; now passes. Marking bug Verified Fixed -
Status: RESOLVED → VERIFIED
Targeting as resolved against 1.5R3
Target Milestone: --- → 1.5R3
You need to log in before you can comment on or make changes to this bug.