Subj : Re: Constructor function cleanly failing To : netscape.public.mozilla.jseng From : Matthew Mondor Date : Mon Jan 10 2005 03:28 pm On Mon, 10 Jan 2005 09:49:28 -0800 Shanti Rao wrote: > You can trap exceptions in the calling code, like > > var a; > try { > a = new Foo() > } catch(x) {} > > The exception (x) can have extra information passed from your constructor. > > JS_SetPendingException(cx,STRING_TO_JSVAL(JS_NewStringCopyZ(cx,"Error > description"))); > *rval = OBJECT_TO_JSVAL(NULL); > return JS_FALSE; Ah thanks, this fixes the problem I had :) Matt .