Home arrow JavaScript arrow Exception Handling in JavaScript: Catching User Input
JAVASCRIPT

Exception Handling in JavaScript: Catching User Input


In a previous article, Alejandro Gervasio explained some key concepts related to working with primary error types, and how they are raised by JavaScript interpreters. This article will focus on developing specific sample code for trapping most of the primary error types according to data entered by users.

Author Info:
By: Alejandro Gervasio
Rating: 4 stars4 stars4 stars4 stars4 stars / 14
September 27, 2005
TABLE OF CONTENTS:
  1. · Exception Handling in JavaScript: Catching User Input
  2. · Using multiple error handlers: a quick overview of the previous script
  3. · Catching user data: triggering errors through web forms
  4. · A quick and dirty error handler: using JavaScript prompts

print this article
SEARCH DEVARTICLES

Exception Handling in JavaScript: Catching User Input
(Page 1 of 4 )

Introduction

This is the third part of the series “Exception handling in JavaScript.” Welcome back. Throughout the previous part, I explained some key concepts related to working with primary error types, along with using multiple exception handlers for trapping different raised errors. Of course, numerous examples were demonstrated, aimed primarily at exposing clearly how most primary error types can be deliberately triggered. In this way, it’s possible to implement the proper error handlers and see how JavaScript code can react and handle unexpected conditions during program execution.

If you’ve been playing around with the examples that I showed in the previous tutorial, then you already have a pretty clear idea of how primary error types are raised by the vast majority of JavaScript interpreters. Although sample code isn’t meant for the production environment, it does illustrate core concepts inherent to implementing “try-catch” blocks within JavaScript programs, with the goal of making them look more professional from a programming point of view. As you know, exceptions allow you to establish specific fragments of code for trapping raised errors, while maintaining “regular” routines focused on dealing with normal and expected situations.

This powerful ability can make a big difference, particularly when working with large applications, where centralized error handling is often required, by introducing a considerable impact on JavaScript code development.

By returning to the objectives of this third part of the series, strong attention will be put on developing specific sample code focused on trapping most of the primary error types according to data entered by users. Hopefully the experience will be instructive enough to illustrate how primary errors can be caught by the appropriate error handlers, based on user-provided input.

Now that you have a clear idea of the topics to be treated in this article, we can move on to writing the complete scripts for working with user-supplied data.


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials