Catching javascript errors in Android

1,422 views
Skip to first unread message

jxp

unread,
Jan 28, 2013, 5:30:03 AM1/28/13
to phon...@googlegroups.com
I'm looking at the best way to catch unexpected javascript errors in my application.
Android WebView does not support window.onerror for this.

I can see the errors coming up in logcat (both from CordovaLog and Web Console).
My first thought was to receive the logcat messages but it doesn't look like you can do this.
You can read the whole of logcat when you know an error has occurred but not receive messages in an ongoing form.

I also looked at whether I could override console.error but that didn't seem to be where there logcat errors were coming from.

My next thought is to look into the Cordova source code to try and figure out how it is logging javascript errors.

Has anyone else looked at reporting unexpected javascript errors on Android?
Do you have any ideas of other techniques for catching these?

Jason Rosenbaum

unread,
Jan 28, 2013, 9:35:09 AM1/28/13
to phon...@googlegroups.com
I haven't had a lot of luck catching errors, but this has been really helpful:


At the very least, you get a console to query your app with, which can help tracking down where errors might be occurring.


_________________________________
Jason Rosenbaum

Email/GChat: sem...@theseminal.com
Cell: 914.806.1939
Twitter: http://twitter.com/j_ro





--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
 
 

jxp

unread,
Jan 29, 2013, 5:09:47 AM1/29/13
to phon...@googlegroups.com
Having looked through the cordova source code, it seems to be quite easy to catch errors and trigger an event.
I have created an issue with a suggested code change on jira https://issues.apache.org/jira/browse/CB-2303

Hopefully this can be added to a future release of PhoneGap.
Reply all
Reply to author
Forward
0 new messages