Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How can I handle Javascript errors

4 posts in General Discussion Last posting was on 2005-10-20 16:10:40.0Z
Chris M Posted on 2005-10-19 13:21:48.0Z
Sender: 43e3.43564634.1804289383@sybase.com
From: Chris M
Newsgroups: ianywhere.public.mbusinessanywhere.general
Subject: How can I handle Javascript errors
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4356486c.43ef.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 19 Oct 2005 06:21:48 -0700
X-Trace: forums-1-dub 1129728108 10.22.241.41 (19 Oct 2005 06:21:48 -0700)
X-Original-Trace: 19 Oct 2005 06:21:48 -0700, 10.22.241.41
Lines: 34
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:602
Article PK: 8978

Hi all,

Is there a standard (or at least suggested) way to handle
Javascript errors on a AvantGo mobile device. I was looking
at the JScript Developer reference and it says;

"Runtime errors are not reported as exceptions; rather,
AvantGo displays an error dialog and aborts execution of the
current script when an error occurs.
The following objects are not implemented at all: Error,
EvalError,
RangeError, ReferenceError, SyntaxError, TypeError, and
URIError."

I would like a way to trap an error and report something
useful to the PDA user. It would also be nice to clean up
resources that may be left open (XML databases etc).

I have tried the following, but it didn't work;
script type="text/javascript">
<!-- //

function handleError() {
return true;
}

window.onerror = handleError;
//-->
</script>

Any ideas are much appreciated.

Thanks,
Chris


Enrico Pallazzo Posted on 2005-10-19 14:06:51.0Z
From: "Enrico Pallazzo" <enricopallazzo@myway.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <4356486c.43ef.1681692777@sybase.com>
Subject: Re: How can I handle Javascript errors
Lines: 73
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
X-Original-NNTP-Posting-Host: vpn-dub-061.sybase.com
Message-ID: <43565214$1@forums-2-dub>
X-Original-Trace: 19 Oct 2005 07:03:00 -0700, vpn-dub-061.sybase.com
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 19 Oct 2005 07:03:01 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 19 Oct 2005 07:06:51 -0700
X-Trace: forums-1-dub 1129730811 10.22.108.75 (19 Oct 2005 07:06:51 -0700)
X-Original-Trace: 19 Oct 2005 07:06:51 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!forums-2-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:603
Article PK: 17734

You can use try and catch.

<html>

<head>
<meta name="HandheldFriendly" content="true">
<title>a page</title>
</head>

<body>
Should see alert of "5".<p>

<script>
function foo()
{
var x;
try {
throw 5;
}
catch (x) {
alert(x);
}

}
</script>

<form method="POST">
<p> <input type="button" value="hey" name="B5" onclick="var v; foo();">
</form>
<a href="exception3.html">next (exception3.html)</a>
</body>
</html>

<Chris M> wrote in message news:4356486c.43ef.1681692777@sybase.com...
> Hi all,
>
> Is there a standard (or at least suggested) way to handle
> Javascript errors on a AvantGo mobile device. I was looking
> at the JScript Developer reference and it says;
>
> "Runtime errors are not reported as exceptions; rather,
> AvantGo displays an error dialog and aborts execution of the
> current script when an error occurs.
> The following objects are not implemented at all: Error,
> EvalError,
> RangeError, ReferenceError, SyntaxError, TypeError, and
> URIError."
>
> I would like a way to trap an error and report something
> useful to the PDA user. It would also be nice to clean up
> resources that may be left open (XML databases etc).
>
> I have tried the following, but it didn't work;
> script type="text/javascript">
> <!-- //
>
> function handleError() {
> return true;
> }
>
> window.onerror = handleError;
> //-->
> </script>
>
> Any ideas are much appreciated.
>
> Thanks,
> Chris


Enrico Pallazzo Posted on 2005-10-19 16:41:24.0Z
From: "Enrico Pallazzo" <enricopallazzo@myway.com>
Newsgroups: ianywhere.public.mbusinessanywhere.general
References: <4356486c.43ef.1681692777@sybase.com> <43565214$1@forums-2-dub>
Subject: Re: How can I handle Javascript errors
Lines: 80
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
X-RFC2646: Format=Flowed; Response
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
NNTP-Posting-Host: vpn-dub-061.sybase.com
X-Original-NNTP-Posting-Host: vpn-dub-061.sybase.com
Message-ID: <43567734$1@forums-1-dub>
Date: 19 Oct 2005 09:41:24 -0700
X-Trace: forums-1-dub 1129740084 10.22.120.61 (19 Oct 2005 09:41:24 -0700)
X-Original-Trace: 19 Oct 2005 09:41:24 -0700, vpn-dub-061.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:604
Article PK: 8979

My bad. The MBA Javascript engine doesnt throw execptions on error. Sorry.

"Enrico Pallazzo" <enricopallazzo@myway.com> wrote in message
news:43565214$1@forums-2-dub...
>
> You can use try and catch.
>
> <html>
>
> <head>
> <meta name="HandheldFriendly" content="true">
> <title>a page</title>
> </head>
>
> <body>
> Should see alert of "5".<p>
>
> <script>
> function foo()
> {
> var x;
> try {
> throw 5;
> }
> catch (x) {
> alert(x);
> }
>
> }
> </script>
>
> <form method="POST">
> <p> <input type="button" value="hey" name="B5" onclick="var v; foo();">
> </form>
> <a href="exception3.html">next (exception3.html)</a>
> </body>
> </html>
>
>
>
> <Chris M> wrote in message news:4356486c.43ef.1681692777@sybase.com...
>> Hi all,
>>
>> Is there a standard (or at least suggested) way to handle
>> Javascript errors on a AvantGo mobile device. I was looking
>> at the JScript Developer reference and it says;
>>
>> "Runtime errors are not reported as exceptions; rather,
>> AvantGo displays an error dialog and aborts execution of the
>> current script when an error occurs.
>> The following objects are not implemented at all: Error,
>> EvalError,
>> RangeError, ReferenceError, SyntaxError, TypeError, and
>> URIError."
>>
>> I would like a way to trap an error and report something
>> useful to the PDA user. It would also be nice to clean up
>> resources that may be left open (XML databases etc).
>>
>> I have tried the following, but it didn't work;
>> script type="text/javascript">
>> <!-- //
>>
>> function handleError() {
>> return true;
>> }
>>
>> window.onerror = handleError;
>> //-->
>> </script>
>>
>> Any ideas are much appreciated.
>>
>> Thanks,
>> Chris
>
>


Chris M Posted on 2005-10-20 16:10:40.0Z
Sender: 43e3.43564634.1804289383@sybase.com
From: Chris M
Newsgroups: ianywhere.public.mbusinessanywhere.general
Subject: Re: How can I handle Javascript errors
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4357c180.56ae.1681692777@sybase.com>
References: <43567734$1@forums-1-dub>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 20 Oct 2005 09:10:40 -0700
X-Trace: forums-1-dub 1129824640 10.22.241.41 (20 Oct 2005 09:10:40 -0700)
X-Original-Trace: 20 Oct 2005 09:10:40 -0700, 10.22.241.41
Lines: 84
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.mbusinessanywhere.general:605
Article PK: 17735

No problems. Thanks anyway. Is that why my "window.onerror =
handleError;" wouldn't work (cause the MBA Javascript engine
doesn't throw exceptions)?

> My bad. The MBA Javascript engine doesnt throw execptions
> on error. Sorry.
>
> "Enrico Pallazzo" <enricopallazzo@myway.com> wrote in
> message news:43565214$1@forums-2-dub...
> >
> > You can use try and catch.
> >
> > <html>
> >
> > <head>
> > <meta name="HandheldFriendly" content="true">
> > <title>a page</title>
> > </head>
> >
> > <body>
> > Should see alert of "5".<p>
> >
> > <script>
> > function foo()
> > {
> > var x;
> > try {
> > throw 5;
> > }
> > catch (x) {
> > alert(x);
> > }
> >
> > }
> > </script>
> >
> > <form method="POST">
> > <p> <input type="button" value="hey" name="B5"
> > onclick="var v; foo();"> </form>
> > <a href="exception3.html">next (exception3.html)</a>
> > </body>
> > </html>
> >
> >
> >
> > <Chris M> wrote in message
> news:4356486c.43ef.1681692777@sybase.com... >> Hi all,
> >>
> >> Is there a standard (or at least suggested) way to
> handle >> Javascript errors on a AvantGo mobile device. I
> was looking >> at the JScript Developer reference and it
> says; >>
> >> "Runtime errors are not reported as exceptions; rather,
> >> AvantGo displays an error dialog and aborts execution
> of the >> current script when an error occurs.
> >> The following objects are not implemented at all: Error
> , >> EvalError,
> >> RangeError, ReferenceError, SyntaxError, TypeError, and
> >> URIError."
> >>
> >> I would like a way to trap an error and report
> something >> useful to the PDA user. It would also be
> nice to clean up >> resources that may be left open (XML
> databases etc). >>
> >> I have tried the following, but it didn't work;
> >> script type="text/javascript">
> >> <!-- //
> >>
> >> function handleError() {
> >> return true;
> >> }
> >>
> >> window.onerror = handleError;
> >> //-->
> >> </script>
> >>
> >> Any ideas are much appreciated.
> >>
> >> Thanks,
> >> Chris
> >
> >
>
>