Solved

Exception Integration Advice....

Posted on 2003-11-15
5
227 Views
Last Modified: 2010-04-16
Hello,

I am developing an application that requires the development of 30 user defined application exceptions.

Would it be prudent to design a dedicated dll that consists of all the custom exceptions and add it as a reference to the assemblies that require the exceptions or would it be advantageous to include only those exceptions that are required in each assembly.

kind regards Imran Farooq
0
Comment
Question by:imran89
  • 2
  • 2
5 Comments
 
LVL 10

Expert Comment

by:smegghead
ID: 9754022
I would suggest a comprimise between the two... I would just have a .cs file which contains ALL the exception definitions, and include it in all projects that require it.
0
 

Author Comment

by:imran89
ID: 9754106
Just to understand your advice further...if I have 3 projects, one exe and two dlls they would each contain an identical .cs file consisting of all the custom defined exceptions.

Is this what you mean?

My concern is the duplication of the identical .cs file. Could there be a way to define the .cs file that all projects access without duplication?

kind regards Imran
0
 
LVL 10

Expert Comment

by:smegghead
ID: 9754131
Yes, sorry, in this case, I would do as your first suggest.. create a dll which contains all the exception definitions, and add the dll as a refernce to all required projects.
0
 

Author Comment

by:imran89
ID: 9754190
by creating a dll with all the exceptions...would this effect the way the exception will be thrown?

kind regards Imran
0
 
LVL 10

Accepted Solution

by:
ptmcomp earned 50 total points
ID: 9754206
I think the exception should be defined in the assemblies which are throwing them.
Resons:
- If you desing properly you only get exceptions of the assemblies you directly include.
- If an assembly needs an exception definition more or less it's in the responsibility of the assembly

You may have an assembly with basic definition and an abstract base exception which is included in all assemblies.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question