Closed Bug 433618 Opened 16 years ago Closed 2 years ago

JS_GetPendingException doesn't return objects other than Error

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: taras.mozilla, Unassigned)

Details

Attachments

(1 file)

I was trying to throw custom objects instead of Error objects and noticed that JS_GetPendingException doesn't return those.
Here is a session in a slightly modified js shell.
js> throw new Error()
JS_GetPendingException: 1
typein:1:
js> throw new Object()
JS_GetPendingException: 0
uncaught exception: [object Object]
js>
 
shaver says this might be a bad bug.
We explicitly clear the exception before calling the error reporter for uncaught exceptions, I suspect in case the reporter calls script:

http://lxr.mozilla.org/mozilla/source/js/src/jsexn.c#1293

Set JSOPTION_DONT_REPORT_UNCAUGHT on the context if you don't want the conversion to error.

(Whew!)
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
Or not.  We should SetPending/ClearPending around both flavours of error-reporter calling.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Assignee: general → nobody
Status: REOPENED → RESOLVED
Closed: 16 years ago2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: