JS_GetPendingException doesn't return objects other than Error

REOPENED
Unassigned

Status

()

Core
JavaScript Engine
REOPENED
10 years ago
3 years ago

People

(Reporter: (dormant account), Unassigned)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

10 years ago
Created attachment 320822 [details] [diff] [review]
shows JS_GetPendingException

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
Last Resolved: 10 years ago
Resolution: --- → INVALID
Or not.  We should SetPending/ClearPending around both flavours of error-reporter calling.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
(Assignee)

Updated

3 years ago
Assignee: general → nobody
You need to log in before you can comment on or make changes to this bug.