Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2004, 01:40 PM
Authorized User
 
Join Date: Mar 2004
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default Inherit Exception or ApplicationException

I read that it's recommended to derive custom exceptions from System.ApplicationException.
On pg.39 it says, "We will create our own custom derivative of System.ApplicationException", however the code Inherits System.Exception, not System.ApplicationException.
Is the code wrong?

 
Old March 26th, 2004, 04:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I always heard to create a custom ApplicationException class in your application, which is based on the System.Exception class...
 
Old March 27th, 2004, 01:48 AM
Authorized User
 
Join Date: Mar 2004
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here's what I read in the VS.NET help:

.NET Developers Guide
Best Practices for Handling Exceptions

Do not derive user-defined exceptions from the Exception base class. For most applications, derive custom exceptions from the ApplicationException class.

What would be the implications of changing Public Class AppException to inherit System.ApplicationException instead of System.Exception?

 
Old March 27th, 2004, 10:42 PM
Authorized User
 
Join Date: Mar 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

According to what I've read System.Exception and System.ApplicationException exist so that catch filters can easily differentiate between exceptions thrown by the system and exceptions thrown by the application. A policy that Microsoft itself violates.

Other than that I don't think it makes any difference and I don't think it would matter if you changed AppException to derive from System.ApplicationException.

For a really good discussion of exceptions and exception handling, see Jeffrey Richter's book "Applied Microsoft .NET Framework Programming"

Richard Waddell









Similar Threads
Thread Thread Starter Forum Replies Last Post
about picturebox inherit youtubeline C# 3 December 12th, 2008 03:41 PM
Chapter 7, Inherit keyword not working VictorVictor BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 April 12th, 2006 12:13 PM
Can we Inherit ADODB venki5star Visual Studio 2005 3 March 13th, 2006 10:50 AM
ApplicationException vs. Exception tkubaska BOOK: ASP.NET Website Programming Problem-Design-Solution 1 April 13th, 2004 09:15 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.