Re: When to create your own exception class?



Carlos J. Quintero [.NET MVP] <carlosq@xxxxxxxxxxxxxxxxxxx> wrote:
> The actual point about exceptions is that they should:
>
> - Provide a friendly message to the user in non-technical terms about what
> happened, why and most important, how to recover from it

I'm not at all convinced about that one. Chances are, the exception is
dealing with some concept that the user has *no* clue about. For
instance, say a parameter is null when it shouldn't be - how can you
explain that in non-technical terms? How many users are going to have
the faintest idea what null is?

In my experience, you need something at a much higher level to tell the
user that something has gone wrong. The message displayed may depend on
the exception generated, but it's unlikely to be known by the exception
itself.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: Problem with KITL?
    ... > Enable kernel debugger ... This OK if KdStub stumbling on its own BP. ... Exception in debugger, Addr=0x801AB864 - attempting to recover ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Yet again - closing a thread
    ... effort was involved in adding exception handlers to recover at each level where recovery ... I was able to recover and keep running. ... it is very likely a bug in the program. ... then the Wait will not fail. ...
    (microsoft.public.vc.mfc)
  • Re: General exception Handling question
    ... The idea is to catch the exception and, ... possible, recover from it cleanly. ... I think you should always implement a try-catch at the highest level ... middle of the night if my app dies a horrible death. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Reconnect after Oracle maintenance
    ... maintenance), but once in a while it is still not able to recover, and ... driver level caching of the older corrupt connections that are retained ... When the DB recovers, our application throws the following exception, ...
    (microsoft.public.dotnet.framework.adonet)