JScript .NET, Part XII: Exception Handling - Doc JavaScript | WebReference

JScript .NET, Part XII: Exception Handling - Doc JavaScript


JScript .NET, Part XII: Exception Handling

In this column we continue our series on JScript .NET. In Part I, we laid down the groundwork for JScript .NET, showing you how to install IIS and the .NET SDK, and how to compile and run a JScript .NET program. In Part II, we showed you the major differences between JavaScript and JScript .NET. In Part III, we focused on JScript .NET's classes and their division among namespaces. In Part IV we taught you how to use inheritance in classes and interfaces. In Part V, we covered the third holy grail of object oriented programming: polymorphism. In Part VI, we showed you how to define Web services in JScript .NET and how to consume them from Internet Explorer. In Part VII, we showed you how to consume Web services from ASP.NET pages in general, and the add Web service in particular. In Part VIII, we showed you how to consume the IsPrime Web service. In Part IX, we introduced the concept of Code Behind. In Part X, we explained how to display information with JScript .NET. In Part XI we showed you how to create Windows forms with JScript .NET code. In this column we'll cover exception handling in JScript .NET.

Exception handling is a common technique to deal with run-time errors. Most modern programming languages support exception handling in a certain fashion. In Column 38 we covered exception handling on the client side, and we compared JavaScript's support to Java's, C++'s, and VB's. In this column, we'll reiterate the motivation for using exceptions as opposed to if..else statements. We'll show you how to use the try...catch...finally statement, how to throw and catch exceptions, and how to use Error objects.

In this column you will learn:

Next: The advantage of exceptions


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: September 9, 2002
Revised: September 9, 2002

URL: http://www.webreference.com/js/column118/index.html