Custom Application Exception handling?

Topics: Exception Handling Application Block
Jan 11, 2009 at 3:51 PM
Can I handle my custom Entlib application exceptions (e.g.  throw new ApplicationException("XYZ") ) or the exception handling is only about system and database exceptions?
 
TIA
Iordanis
Jan 12, 2009 at 6:16 AM
Hi,

Yes you can handle Custom Application Exception. After you add a Policy in you exception handling block, you are going to add a Exception type in which you can load or choose your desired exception, even your custom exception.


Hope this Helps.


Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Jan 14, 2009 at 9:57 PM
How can I add my Exception Type? After I add an Exception Policy, the Exception Type popup displays only System exceptions to choose from.
Jan 15, 2009 at 12:16 AM

Click Load From File and locate the assembly where your custom exception is defined.

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Jan 16, 2009 at 2:40 PM
Edited Jan 16, 2009 at 2:42 PM
I haven't done that yet.
So you mean, I should create all my application exception objects inherited from the Exception type and compile them as a separate .dll assemply, so I can select it inside the 'Load from file...' dialog?
Jan 17, 2009 at 3:24 AM
You can add any Exception Type as long as they inherit from the Exception class.  If you only need to use the ApplicationException class, you can do so, it's already provided in the type selector(you can filter the types in the 4.1 version).  If you need to crete your custom exceptions, it's  not mandatory that you place it in a separate assembly.  You could just define it in any executable project and select the "projectname.exe" when using Load From File.


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Jan 17, 2009 at 6:55 PM
Thanks for your guidance.