About this product: This Wrox Blox will teach you how to unravel the mysteries of exception handling in ASP.NET. First, you’ll get a thorough introduction to structured exception handling in the .NET Framework, learn about the Exception class, the related C# language constructs, and how exceptions propagate up the call stack. Then, you’ll delve into a variety of practical topics such as: when, where, and how to properly throw, catch, and handle exceptions in your code; how to employ “defensive programming” techniques to avoid triggering the most common CLR exceptions; adopting exception handling “best practices,” handling exceptions from rich ASP.NET server controls, data-bound controls, data sources, and AJAX asynchronous postbacks; and processing unhandled exceptions at both the page and application levels.
The author also walks you through the building of a complete, reusable, and fully configurable ASP.NET exception processing framework that extends far beyond ASP.NET’s built-in error handling capabilities. You’ll learn how to collect information about the state of the application when the exception occurred; how to leverage various ASP.NET state-handling mechanisms such as Application, Context, Session, ASP.NET Cache, cookies, and query strings to store and pass error data; create a friendly, informative, and highly functional custom error UI; show friendly error messages to “normal” visitors, while showing detailed error reports only to site managers based on authentication, authorization, or IP; provide a way for users to add their own information to error reports; persist errors to the Windows Event Log, XML files, or a custom database; send detailed error notifications via e-mail and SMS text; and build an administrative dashboard to list, sort, page, view, and manage error logs.
Once complete, you’ll learn how to quickly and easily add this new framework to any web site you create using a simple .NET assembly. A complete sample application and C# source code for the exception processing framework are available as a companion download.
Table of Contents
What Is an Exception? 2
The Exception Class 3
Structured Exception Handling 5
Handling Exceptions 5
Exception Propagation: Part 1 9
Throwing Exceptions 11
Exception Handling Best Practices 13
Defensive Programming 13
Choose the Right Exception to Throw 17
Exceptions Should Be Exceptional 18
Don’t Abuse Exceptions 18
Avoid Swallowing Exceptions 19
Don’t Try to Handle Everything 20
Other Exception Handling Scenarios 20
Handling Exceptions in ASP.NET Data Sources 21
Handling Exceptions in ASP.NET Data-Bound Controls 22
Handling Exceptions in ASP.NET Rich Server Controls 22
Handling Exceptions in Asynchronous Postbacks 24
Managing Unhandled Exceptions in ASP.NET 25
Exception Propagation: Part 2 25
The ASP.NET Default Exception Handler 28
Page.Error and HttpApplication.Error 30
Building a Custom ASP.NET Exception Handler 32
The “Fourth Coffee” Sample Site 33
The LD.ExceptionHandling Class Library 39
Creating a Custom Error UI 54
Adding the Custom Exception Handler to Your Own Site 56
Conclusion 57
Lee Dumond 58
Usage Rights for Wiley Wrox Blox
Any Wrox Blox you purchase from this site will come with certain restrictions that allow Wiley to protect the copyrights of its products. After you purchase and download this title, you:
Are entitled to three downloads
Are entitled to make a backup copy of the file for your own use
Are entitled to print the Wrox Blox for your own use
Are entitled to make annotations and comments in the Wrox Blox file for your own use
May not lend, sell or give the Wrox Blox to another user
May not place the Wrox Blox file on a network or any file sharing service for use by anyone other than yourself or allow anyone other than yourself to access it
May not copy the Wrox Blox file other than as allowed above May not copy, redistribute, or modify any portion of the Wrox Blox contents in any way without prior permission from Wiley
If you have any questions about these restrictions, you may contact Customer Care at (877) 762-2974 (8 a.m. - 5 p.m. EST, Monday - Friday). If you have any issues related to Technical Support, please contact us at 800-762-2974 (United States only) or 317-572-3994 (International) 8 a.m. - 8 p.m. EST, Monday - Friday).
About this product: Robust Java Exception Handling, Testing and Debugging
Complete guide to Java platform exceptions and exception handling
Proven strategies for architects, designers, and developers
Key design patterns for exception management
Stephen Stelting
Your one-stop tutorial & reference for Java exceptions and exception handling
Sorry, you're not perfect. And neither is your code. But you can build more robust software: code that handles unexpected problems gracefully, and keeps on running. In Robust Java, Sun Java expert Stephen Stelting shows you how. Using extensive code examples, Steve covers every facet of Java exceptions and exception handling, encompassing architecture, design, development, testing, and debugging. With the help of this book, you'll:
Discover best practices for Java exception handling Learn failure mode analysis: how to anticipate where errors are most likely to occur Understand the use of exceptions in complex APIs and frameworks including J2EE, JDBC, RMI, JMS, and more Master application-wide exception handling strategies Implement exceptions in complex distributed multi-tier systems Learn proven design patterns for handling exceptions in code Perform more effective Java testing and debugging using open source tools Understand key architectural decisions that will improve robustness
Robust Java covers the entire development lifecycle—and it will support you in any development role: programmer, tester, project manager, or architect. No book offers more useful, realistic guidance for building rock-solid, maintainable Java code.
About this product: Deals with topics related to exception handling in the context of programming language models, design methodologies, concurrent and distributed systems, applications and experiences, and large-scale systems such as database and workflow process management systems. Softcover.
About this product: A Java Virtual Machine is a set of computer software programs and data structures that use a virtual machine model for the execution of other computer programs and scripts. The model used by a JVM accepts a form of computer intermediate language commonly referred to as Java bytecode. This language conceptually represents the instruction set of a stack-oriented, capability architecture. Sun claims there are over 4.5 billion JVM-enabled devices.
About this product: Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of exceptions, special conditions that change the normal flow of program execution. Unlike signals and event handlers that are part of the normal program flow, exceptions are typically used to signal that something went wrong (e.g. a division by zero occurred or a required file was not found). Exceptions are raised or thrown (initiated) by either the hardware or the program itself by using a special command. Programming languages differ considerably in their support for exception handling as distinct from error checking. In some programming languages there are functions which cannot be safely called on invalid input data ... or functions which return values which cannot be distinguished from exceptions. For example in C, the atoi (ASCII to integer conversion) function may return 0 (zero) for any input that cannot be parsed into a valid value. In such languages the programmer must either perform error checking (possibly through some auxiliary global variable such as C's errno) or input validation (perhaps using regular expressions).
About this product: This digital document is a journal article from Decision Support Systems, published by Elsevier in 2004. The article is delivered in HTML format and is available in your Amazon.com Media Library immediately after purchase. You can view it with any web browser.
Description: In this paper, we propose an architecture model that deals with both expected and unexpected exceptions in the context of workflow management. Expected exceptions and their handling approaches are specified by ECA rules, while cases of unexpected exceptions are characterized by their features and resolution approaches. The handling of unexpected exceptions is then assisted by the system providing information about how recent similar cases were resolved. The ways in which the previous exception cases were handled provides useful information in determining how to handle the current one. Quantifying the similarity of exception cases is described, and three algorithms for efficiently searching for similar exception cases are proposed and evaluated both theoretically and by experimenting with synthetic data sets.
About this product: Exception handling mechanisms were conceived as a means to improve maintainability and reliability of programs that have to deal with exceptional situations. They are included in several mainstream programming languages and promote a certain degree of textual separation between normal and exceptional behaviour. Even though maintainability and reliability motivated the adoption of exception handling, several studies indicate that achieve them is difficult in real-life exception handling implementations. Our claim is that this difficulty is caused by the local way in which global exceptions are handled in conventional exception handling models. This book describes an innovative platform- independent model for exception handling, called EFlow, which aims to improve the simultaneous satisfaction of software maintainability and reliability. EFlow is mainly grounded on the notion of explicit exception channels, which support modular representation of global exceptional- behaviour properties. EFlow was concretised by two distinct full-fledged implementations: EJFlow(Java-based) and ESFlow (UML-based).
Modern software systems are becoming more complex in many ways and are having to cope with a growing number of abnormal situations which, in turn, are increasingly complex to handle. Exception handling is an essential part of software and system architectures and a crucial element in the tool-set that enables the building of resilient, robust and safe software systems. Two ECOOP workshops on exception handling were held in 2003 and 2005. This book is primarily an outcome of these two events - several workshop participants as well as a number of other leading researchers in the field were invited to contribute a chapter each.
This book is composed of five parts; the first four deal with topics related to exception handling in the context of programming languages, concurrency and operating systems, pervasive computing systems, and requirements and specifications. The last part focuses on case studies, experimentation and qualitative comparisons. The 16 coherently written chapters by leading researchers competently address a wide range of issues in exception handling.
About this product: This Technical Report specifies an extension of the programming language Fortran, specified by the international standard ISO/IEC 1539-1:1997. Its main aim is to provide support for the five exceptions of the IEEE standard for floating-point arithmetic, but it also provides support for other features of the IEEE standard. A processor is permitted to provide partial support and there are facilities for enquiring about which features are supported or requiring support of certain features.Clause 2 of this Technical Report contains a technical description of the features. It provides an overview and does not include all the fine details. Clause 3 contains the editorial changes to the standard and thereby provides a complete definition.