Answered by:
Application Exception vs Exception??

Question
-
Why do we need to define the ApplicationException when we have Exception class?
And In a MVC architect application, where should we implement the ApplicationException approach, clent or server??
Thanks!! http://gurunguns.wordpress.comMonday, June 21, 2010 4:37 PM
Answers
-
If you are designing an application that needs to create its own exceptions, you are advised to derive custom exceptions from the Exception class. It was originally thought that custom exceptions should derive from the ApplicationException class; however in practice this has not been found to add significant value. For more information, see Best Practices for Handling Exceptions.
Framework Design Guidelines: Do not throw or derive from System.ApplicationException.
JEFFREY RICHTER: System.ApplicationException is a class that should not be part of the .NET Framework. The original idea was that classes derived from SystemException would indicate exceptions thrown from the CLR (or system) itself, whereas non-CLR exceptions would be derived from ApplicationException
similar thread http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/9f7ab158-92bc-4eca-8744-52fa41873593
Manish SatiTuesday, June 22, 2010 7:03 AM -
You can use ApplicationException as base class for your application level exception. So when your method called and caller have try catch so we can easily identify all application level exception by using below try catch.
try
{
}
catch{ApplicationException ex)
}
As all exception have base Exception you can't use that to identify that exception has been thrown by your application or not. It is not compulsory to use ApplicationException as base class for your application level exception but it is just standard to know that exception is thrown by your application.
Regards
Nayan Paregi (MCTS)
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.- Marked as answer by SamAgain Tuesday, June 29, 2010 9:49 AM
Monday, June 21, 2010 6:26 PM
All replies
-
You can use ApplicationException as base class for your application level exception. So when your method called and caller have try catch so we can easily identify all application level exception by using below try catch.
try
{
}
catch{ApplicationException ex)
}
As all exception have base Exception you can't use that to identify that exception has been thrown by your application or not. It is not compulsory to use ApplicationException as base class for your application level exception but it is just standard to know that exception is thrown by your application.
Regards
Nayan Paregi (MCTS)
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.- Marked as answer by SamAgain Tuesday, June 29, 2010 9:49 AM
Monday, June 21, 2010 6:26 PM -
If you are designing an application that needs to create its own exceptions, you are advised to derive custom exceptions from the Exception class. It was originally thought that custom exceptions should derive from the ApplicationException class; however in practice this has not been found to add significant value. For more information, see Best Practices for Handling Exceptions.
Framework Design Guidelines: Do not throw or derive from System.ApplicationException.
JEFFREY RICHTER: System.ApplicationException is a class that should not be part of the .NET Framework. The original idea was that classes derived from SystemException would indicate exceptions thrown from the CLR (or system) itself, whereas non-CLR exceptions would be derived from ApplicationException
similar thread http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/9f7ab158-92bc-4eca-8744-52fa41873593
Manish SatiTuesday, June 22, 2010 7:03 AM