Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error handling - Help required !!

5 views
Skip to first unread message

Rajat Gupta

unread,
Nov 7, 2009, 11:41:30 AM11/7/09
to dev-tech-js-...@lists.mozilla.org
Hi Support !

I am using rhino.
How i can do error handing using rhino ?

Question example -
I had some method which is having some n number of input params, if one required param is undefine then i want to throw an error. For this I made a JS scriptable error object.
so how i can set this error object by using rhino error object ( if it does have) ?

please explain in detail.
I would be very thankful to you.

Thanks.
Rajat


fel

unread,
Nov 9, 2009, 9:44:23 AM11/9/09
to

send the code

Rajat Gupta

unread,
Nov 11, 2009, 2:00:23 AM11/11/09
to fel, dev-tech-js-...@lists.mozilla.org
Hi friends !

Here is the code.

try{
alert(); // one argument is required for alert
}catch(e){
console.println( "e = " + e)
console.println( "e.name = " + e.name)
}

or just call

alert(); // one argument is required for alert

can we get the e object ?
what is the type of e object ?


Thanks
Rajat


________________________________
From: fel <felipe...@gmail.com>
To: dev-tech-js-...@lists.mozilla.org
Sent: Mon, November 9, 2009 8:14:23 PM
Subject: Re: Error handling - Help required !!

send the code
_______________________________________________
dev-tech-js-engine-rhino mailing list
dev-tech-js-...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino


fel

unread,
Nov 11, 2009, 7:51:48 AM11/11/09
to
On Nov 11, 2:00 am, Rajat Gupta <innocent_pers...@yahoo.com> wrote:
> Hi friends !
>
> Here is the code.
>
>     try{
>         alert(); // one argument is required for alert
>     }catch(e){
>             console.println( "e = " + e)
>             console.println( "e.name = " + e.name)
>     }
>
> or just call
>
>         alert(); // one argument is required for alert
>
> can we get the e object ?
> what is the type of e object ?
>
> Thanks
> Rajat
>
> ________________________________
> From: fel <felipeval...@gmail.com>
> To: dev-tech-js-engine-rh...@lists.mozilla.org

> Sent: Mon, November 9, 2009 8:14:23 PM
> Subject: Re: Error handling - Help required !!
>
> On Nov 7, 11:41 am, Rajat Gupta <innocent_pers...@yahoo.com> wrote:
>
> > Hi Support !
>
> > I am using rhino.
> > How i can do error handing using rhino ?
>
> > Question example -
> > I  had some method which is having some n number of input params, if one required param is undefine then i want to throw an error. For this I made a JS scriptable error object.
> > so how i can set this error object by using rhino error object ( if it does have) ?
>
> > please explain in detail.
> > I would be very thankful to you.
>
> > Thanks.
> > Rajat
>
> send the code
> _______________________________________________
> dev-tech-js-engine-rhino mailing list
> dev-tech-js-engine-rh...@lists.mozilla.orghttps://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino


maybe, you can create error objects, by using throw(), but I don't
think using exceptions is a good way of flow control.
(but that's just me).

Rajat Gupta

unread,
Dec 18, 2009, 8:47:45 AM12/18/09
to Daryl Stultz, dev-tech-js-...@lists.mozilla.org
Actually I had a java object corresponding to each JS object.
for example: X500Name java object and corresponding JS x500Name object.

So I need the coressponding java object corresponding to JS e Object in following js script.

try{
alert(); // one argument is required for alert
}catch(e){
console.println( "e = " + e)
console.println( "e.name = " + e.name)
}

Hope you got answer of your question.
Please provide more detailed answer.

Thanks
Rajat

________________________________
From: Daryl Stultz <da...@6degrees.com>
To: Rhino JS User List <dev-tech-js-...@lists.mozilla.org>
Sent: Wed, December 16, 2009 6:42:32 PM
Subject: Re: Fw: Error handling - Help required !!

On Wed, Dec 16, 2009 at 1:09 AM, Rajat Gupta <innocent...@yahoo.com>wrote:

> Hi friends !
>
> This is a gentle remainder.
> I am still waiting for solving this please send me how should i proceed
> regarding this issue.
>
> Rajat, what is it you want to do that you haven't done already?

can we get the e object ?
>

What does that mean? You printed the e object, didn't you?


> what is the type of e object ?
>
>

JS objects don't really have a type in the was Java objects do. Again, what
is your goal?

--
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:da...@6degrees.com

Daryl Stultz

unread,
Dec 18, 2009, 9:11:53 AM12/18/09
to Rhino JS User List
On Fri, Dec 18, 2009 at 8:47 AM, Rajat Gupta <innocent...@yahoo.com>wrote:

> Actually I had a java object corresponding to each JS object.
> for example: X500Name java object and corresponding JS x500Name object.
>

> Ok, I understand that.


> So I need the coressponding java object corresponding to JS e Object in
> following js script.
>

> But I don't understand this. Can you give more details of why you need it
and how you will use it once you get it.

0 new messages