RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX


Build an Error-Submission System for Your JavaScript/AJAX App Users : Page 3

When some applications crash, they offer the user a chance to submit information about the error. This information can help developers track down and fix bugs. This 10-Minute Solution demonstrates how to have your JavaScript/AJAX applications do the same thing.


Implementation Details

These are the functions defined in talkback.js:
  • - tb_wrap( fun ) – This function puts the function fun inside a wrapper, which traps any exceptions and offers the user a chance to send them back to the developers. When an exception occurs, it adds the Error object to a list of exceptions and offers the user a submission link. If any further exceptions happen, it will add them to the list of exceptions and the submission link as well.
  • - tb_show_talkback_link() – This function shows a small floating window that offers the user a chance to submit an error:

    An error has occurred in this page. To report this error, please click here: Report Error

    This window is created only the first time an exception occurs, and it stays on top of other window content. If further exceptions occur, their information is added to the existing mailto: link.

  • - tb_set_link_contents() – Each time an exception is thrown, it is added to a list. Then, the entire list is scanned for useful information, which is then packed into a mailto: link. This link is shown the first time an exception is thrown, and stays up from then on.

Application-Level Support for JavaScript and AJAX Apps

Developers are increasingly using JavaScript and AJAX to create substantial, feature-rich applications. Thus, the need for application-level support is growing. The talkback system gathers as much information about an error as possible and provides the user with a mailto: link for submitting this information. The user, of course, can add any additional information that might help track down the bug.

Greg Travis is a Java programmer and technology writer, living in New York City. After spending three years in the world of high-end PC games, he joined EarthWeb, where he developed new technologies with the then-new Java programming language. Since 1997, he has been a consultant in a variety of Web technologies.
Email AuthorEmail Author
Close Icon
Thanks for your registration, follow us on our social networks to keep up-to-date