Skip to Main Content
C# Cookbook, 2nd Edition
book

C# Cookbook, 2nd Edition

by Jay Hilyard, Stephen Teilhet
January 2006
Intermediate to advanced content levelIntermediate to advanced
1184 pages
43h 23m
English
O'Reilly Media, Inc.
Content preview from C# Cookbook, 2nd Edition
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
398
|
Chapter 7: Exception Handling
something similar to this would be displayed:
System.Exception: The innerInner Exception.
at Chapter_Code.EH.MyMethod( ) in c:\book cs cookbook\code\test.cs:line 286
Notice that no exception other than the innerInner exception is displayed. This use-
ful technique gets to the root of the problem while filtering out all of the other outer
exceptions that you are not interested in.
See Also
See the “Error Raising and Handling Guidelines” and “Exception Class” topics in the
MSDN documentation.
7.13 Creating a New Exception Type
Problem
None of the built-in exceptions in the .NET Framework provide the implementation
details that you require for an exception that you need to throw. You need to create
your own exception class that operates seamlessly with your application, as well as
other applications. Whenever an application receives this new exception, it can
inform the user that a specific error occurred in a specific component. This report
will greatly reduce the time required to debug the problem.
Solution
Create your own exception class. To illustrate, let’s create a custom exception class,
RemoteComponentException, that will inform a client application that an error has
occurred in a remote server assembly.
Discussion
The exception hierarchy starts with ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard
C# Cookbook

C# Cookbook

Joe Mayo
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 0596100639Supplemental ContentCatalog PageErrata