Error handling in compiled languages happens in two stages.
First, compile time messages tell you about syntax errors. Secondly, when you run the application, you get run-time errors. These are generally semantic problems.
JavaScript is an interpreted language and as such compilation and run-time happen one after the other when the script is executed. Some implementations parse and tokenize the entire script before executing any of it, others may parse and execute a line at a time.
If you are handling errors in server-side code, you may be able to make use of the following methods/properties of the Netscape Enterprise Server's server-side objects. These will tell you about errors that have just occurred:
majorErrorCode()
majorErrorMessage()
minorErrorCode()
minorErrorMessage()
The status codes returned by NES database calls imply that you should inspect these error code values when the status code is 5 or 7 (depending on the database type).
In an effort to make the Internet more accessible to inexperienced users, you may find some browsers, especially those in TV set-top boxes, handle errors silently. A fatal error in a script may halt the script and indeed stop any others executing on the page. However, the user will not receive any warning that this has happened. This is certainly the case with the WebTV set-top box and may be true of others.
Prev | Home | Next |
Error handler | Up | Error object |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |