[webkit-dev] JSC: Callback functions returning exception, what should be the JSValueRef return?

Oliver Hunt oliver at apple.com
Tue Aug 11 11:48:04 PDT 2009


On Aug 11, 2009, at 11:40 AM, Darin Adler wrote:

> Since the JavaScript language lets you throw any value as an  
> exception, so does the JavaScriptCore API.
>
> If you want an object for your exception, one that will end up with  
> line number properties and the like, then you’ll need to create one.  
> The API won’t make it for you.
>
> The objects that are thrown by the engine itself are Error objects,  
> but there's no real need for you to use that prototype. You could  
> throw almost any kind of object. I suggest just creating one with  
> JSObjectMake and NULL for the class. And you could attach a message  
> with the property name "message" to be a bit like an Error object.

I consider this to actually be a bug in the engine -- there should be  
some sane way to get information about an exception without depending  
on the exception value itself.

--Oliver



More information about the webkit-dev mailing list