wood burning stoves
The moose likes HTML, CSS and JavaScript and the fly likes Feedback on errors to server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Feedback on errors to server" Watch "Feedback on errors to server" New topic

Feedback on errors to server

Dennis Meyer

Joined: Sep 05, 2003
Posts: 16
I'd appreciate a good solution for giving the server app feedback on errors. They usually will popup at the client which is a bad thing for a bigger web application. We experienced that a lot of errors which are pretty hard to find and debug are JS errors. Having a framework giving feedback to the server (maybve via AJAX) would be great.

[ August 26, 2008: Message edited by: Dennis Meyer ]
[ August 26, 2008: Message edited by: Ulf Dittmer ]
Stoyan Stefanov
Ranch Hand

Joined: Jul 16, 2008
Posts: 61
Hi Dennis, thanks for the question. This is actually pretty easy thing to implement, you can just have an onerror listener and have it send the error data back to the server via XMLHttpRequest or a simple image "beacon".

The thing is that different browsers implement the error objects differently, so your best bet is probably to loop through all the error object's properties and send them.

Off the top of my head, something like:

<a href="http://www.thinkinginjavascript.com" target="_blank" rel="nofollow">my OOJS book</a>
Stoyan Stefanov
Ranch Hand

Joined: Jul 16, 2008
Posts: 61
in the code above "on error" should be "onerror", for some reason the forum software didn't let me post it otherwise.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63232

Stoyan, yeah the forum softwate won;t allow the posting of the onXyz terms or eval(). We usually use HTML entities to get around it.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: Feedback on errors to server
jQuery in Action, 3rd edition