Closed Bug 219055 Opened 21 years ago Closed 21 years ago

Delay creation of script object for EcmaError until execution of script catch

Categories

(Rhino Graveyard :: Core, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: igor, Assigned: igor)

Details

Attachments

(1 file)

Currently Rhino always creates script object representing EcmaError for each EcmaError it throws. But such object is only necessary if script contains a catch statements that catches the exception. Moreover, if creation of such object throws an exception on its own which is quite possible if script mutates Error constructors, then Java application will get the secondary exception which is rather inconvenient. In addition, such delayed creation of script object would allow to simplify internal API since it removes need to pass a scope object argument if such object currently is only necessary to construct script error instances. Such situation is present currently in code that implements script compilation and various ScriptRuntime routines.
Attached patch ImplementationSplinter Review
The essential patch part moves creation of script object represented by NativeError to ScriptRuntime.getCatchObject and modifies EcmaError constructor to take explicit error name and message that will be used when constructing NativeError. The old form is preserved for compatibility but marked as deprecated. The rest of the patch updates code not to pass scope argument when throwing EcmaError instances which allowed to simplify many usages of the error related routines. In addition patch moved functions to create EcmaError instances from NativeGlobal to ScriptRuntime to remove dependence on that class from optimizer and regexps packages which could allow at some point in future (probably a distant point due to backward compatibility) to make the class package private.
I committed the changes.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Rubber-stamp vrfy
Status: RESOLVED → VERIFIED
Trageting as resolved against 1.5R5
Target Milestone: --- → 1.5R5
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: