Click here to Skip to main content
15,890,690 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: When to Define a Custom Exception Pin
HimanshuJoshi14-Jan-11 4:39
HimanshuJoshi14-Jan-11 4:39 
AnswerRe: When to Define a Custom Exception Pin
Ray Cassick14-Jan-11 6:24
Ray Cassick14-Jan-11 6:24 
AnswerRe: When to Define a Custom Exception Pin
Patrick Fox14-Jan-11 6:50
Patrick Fox14-Jan-11 6:50 
AnswerRe: When to Define a Custom Exception Pin
RobCroll14-Jan-11 21:21
RobCroll14-Jan-11 21:21 
AnswerRe: When to Define a Custom Exception Pin
Patrick Skelton14-Jan-11 22:39
Patrick Skelton14-Jan-11 22:39 
GeneralRe: When to Define a Custom Exception Pin
Pete O'Hanlon15-Jan-11 4:20
mvePete O'Hanlon15-Jan-11 4:20 
AnswerRe: When to Define a Custom Exception Pin
dan!sh 15-Jan-11 2:35
professional dan!sh 15-Jan-11 2:35 
AnswerRe: When to Define a Custom Exception Pin
Robert Tanenbaum28-Jan-11 4:20
Robert Tanenbaum28-Jan-11 4:20 
In my opinion there are two situations which REQUIRE the creation of your own exception class.

1. You have a business or data layer checking errors from data entry and throwing an exception. Example: Customer name is missing. By having an exception class specific to your application, the user interface can then create custom error messages attach them to the appropriate user control and display them in a user friendly way that is specific to your application. This also allows for easy implementation of internationalization (localization) by allowing you to create a module that will pick the language specific error message for each individual situation. You don't really want to do that kind of localization at the lower levels.

2. You are implementing a service that crosses machine boundaries. In that case, you want an exception class that serializes well and provides the necessary detail to both debug any situation and to provide sufficiently detailed error messages that will be useful to the end user.

Personally, I am still trying to get used to the idea that throwing exceptions is an appropriate coding practice at an application level. I come from an assembly language and UNIX background where "exceptions" were machine-level faults that totally destroy the application code context, so it was something you would never do in application code. But in the .Net world, throwing exceptions is just as appropriate for handling application errors as returning an error code would be in the UNIX world.

Robert Tanenbaum
GeneralRe: When to Define a Custom Exception Pin
Patrick Skelton28-Jan-11 6:00
Patrick Skelton28-Jan-11 6:00 
QuestionIs it Possible to build a Processor which understands MSIL code. PinPopular
vytheese13-Jan-11 0:46
professionalvytheese13-Jan-11 0:46 
AnswerRe: Is it Possible to build a Processor which understands MSIL code. Pin
Pete O'Hanlon13-Jan-11 0:51
mvePete O'Hanlon13-Jan-11 0:51 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
vytheese13-Jan-11 0:59
professionalvytheese13-Jan-11 0:59 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
Pete O'Hanlon13-Jan-11 1:02
mvePete O'Hanlon13-Jan-11 1:02 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
vytheese13-Jan-11 1:12
professionalvytheese13-Jan-11 1:12 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
Rob Grainger13-Jan-11 22:38
Rob Grainger13-Jan-11 22:38 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
Wesley Harris16-Jan-11 22:16
Wesley Harris16-Jan-11 22:16 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
peterchen14-Jan-11 1:57
peterchen14-Jan-11 1:57 
AnswerRe: Is it Possible to build a Processor which understands MSIL code. Pin
Luc Pattyn13-Jan-11 1:43
sitebuilderLuc Pattyn13-Jan-11 1:43 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
vytheese13-Jan-11 2:25
professionalvytheese13-Jan-11 2:25 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
Luc Pattyn13-Jan-11 2:40
sitebuilderLuc Pattyn13-Jan-11 2:40 
AnswerRe: Is it Possible to build a Processor which understands MSIL code. Pin
Member 725873413-Jan-11 1:48
Member 725873413-Jan-11 1:48 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
vytheese13-Jan-11 2:27
professionalvytheese13-Jan-11 2:27 
AnswerRe: Is it Possible to build a Processor which understands MSIL code. Pin
Dave Kreskowiak13-Jan-11 3:44
mveDave Kreskowiak13-Jan-11 3:44 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
Kirk Wood15-Jan-11 2:03
Kirk Wood15-Jan-11 2:03 
GeneralRe: Is it Possible to build a Processor which understands MSIL code. Pin
Dave Kreskowiak15-Jan-11 4:30
mveDave Kreskowiak15-Jan-11 4:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.