eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Resources
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak

 

Introduction to Web Programming
Error Handling  
  • So far, in the examples we have discussed, there has been little room for user error. That is, for the most part, if there is an error in the program it is our own fault rather than some unforeseen user blunder such as entering letters into a price field or a URL which does not exist. These types of errors can never be exactly programmed around because it is impossible to handle every weird thing that a user might do. We can handle programmatic errors by simply writing error-free code, but we cannot assure that run-time errors will not break our program.

  • Thus, run time errors are just as important to deal with as errors in your programming code. In fact, they are often more important since your users will not be able to find the bug and recompile the program like you will be able to do. At run time, it is too late to debug.

  • In order to handle the exceptional cases in which the user enters data which would cause your program to crash, Java provides a hearty exception handling methodology to catch erroneous input, try several methods to deal with it, and in the worst case, gracefully exit the program.

  • So ho does Java deal with exceptions in the program?

  • Well specifically, when an error occurs, Java will encapsulate all the information about the error in a special error object.

  • Thus, rather than choke on the error, the routine which generates the error will look for an event handler object which can deal with the unexpected problem.

  • The event handler object will look at the error event object and decide what to do from there.

  • Your job is to facilitate this methodology by creating the logic for the exchange of error information between error prone routines and error handlers and the logic that the error handlers will use to sort through the problem.

Previous Page | Next Page