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

.NET (Core and Framework)

 
AnswerRe: When to Define a Custom Exception Pin
PIEBALDconsult14-Jan-11 2:05
mvePIEBALDconsult14-Jan-11 2:05 
AnswerRe: When to Define a Custom Exception Pin
Not Active14-Jan-11 2:36
mentorNot Active14-Jan-11 2:36 
GeneralRe: When to Define a Custom Exception Pin
#realJSOP14-Jan-11 2:53
mve#realJSOP14-Jan-11 2:53 
GeneralRe: When to Define a Custom Exception PinPopular
Not Active14-Jan-11 3:00
mentorNot Active14-Jan-11 3:00 
GeneralRe: When to Define a Custom Exception Pin
#realJSOP14-Jan-11 3:38
mve#realJSOP14-Jan-11 3:38 
GeneralRe: When to Define a Custom Exception Pin
Yusuf14-Jan-11 4:28
Yusuf14-Jan-11 4:28 
GeneralRe: When to Define a Custom Exception Pin
Eddy Vluggen14-Jan-11 11:54
professionalEddy Vluggen14-Jan-11 11:54 
GeneralRe: When to Define a Custom Exception Pin
Daniel Turini15-Jan-11 23:28
Daniel Turini15-Jan-11 23:28 
John Simmons / outlaw programmer wrote:
I generally just do this instead of creating custom exception objects:

catch (Exception ex)
{
throw new Exception("My custom exception message", ex);
}


I believe that is a mistake. I discuss this on my article[^], more deeply but there are 3 main problems with this approach:
1. Internationalization: when you need to catch your exception you'll need to have some sort of switch on the text message. With i18n, which message should you use on the switch?
2. You'll force your users to catch (Exception ex), which is a too broad class and they'll need to handle a lot of other different exceptions.
3. You'l force your users to stop using the more efficient catch (XXXXException) and use a switch instead, which is both less readable and less efficient.
I see dead pixels
Yes, even I am blogging now!

AnswerRe: When to Define a Custom Exception Pin
Single Step Debugger14-Jan-11 3:14
Single Step Debugger14-Jan-11 3:14 
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 
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 

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.