Re: Exception vs Boolean
- From: "Scott M." <s-mar@xxxxxxxxxxxxx>
- Date: Mon, 14 Aug 2006 20:32:23 -0400
Hold on John, you can't have it both ways....
Below, you say that an enum or boolean to indicate success or failure *is* a
"return code", but then you say that "Something returning the number of rows
updated is *not* the same as an error code."
When a command object's executeNonQuery method returns zero, isn't that
*possibly* an indication of an error processing the INSERT, UPDATE or
DELETE?
When a DataReader.Read returns False, *couldn't* that be an indication of an
error?
The answer to both of these is absolutely, yes.
"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:MPG.1f4b1d578231593298d3d4@xxxxxxxxxxxxxxxxxxxxxxx
Cor Ligthert [MVP] <notmyfirstname@xxxxxxxxx> wrote:
By the way, if Scott wrote this somewhere,
Do not return error codes. Exceptions are the primary means of reporting
errors in frameworks."
No, he didn't.
Than do I agree with that in the context of his first message as well. I
was
only talking about Booleans and Enums, in general do I agree with the
text
above if it cannot be done in a simple way with returning the first two
types used in my message. I never would advice to use any return code.
What? An enum or boolean to indicate success or failure *is* a "return
code".
And to show that this can be even different, just have a look at the
DataAdapter Update where the returned integer can be used to see if all
the
rows are completely updated as it should be, this beside the exceptions
also
in this method (which can be set to ignore in the same method).
Something returning the number of rows updated is *not* the same as an
error code.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: Exception vs Boolean
- From: Jon Skeet [C# MVP]
- Re: Exception vs Boolean
- References:
- Re: Exception vs Boolean
- From: Cor Ligthert [MVP]
- Re: Exception vs Boolean
- From: Jon Skeet [C# MVP]
- Re: Exception vs Boolean
- From: Cor Ligthert [MVP]
- Re: Exception vs Boolean
- From: Jon Skeet [C# MVP]
- Re: Exception vs Boolean
- From: Cor Ligthert [MVP]
- Re: Exception vs Boolean
- From: Jon Skeet [C# MVP]
- Re: Exception vs Boolean
- From: Scott M.
- Re: Exception vs Boolean
- From: Jon Skeet [C# MVP]
- Re: Exception vs Boolean
- From: Cor Ligthert [MVP]
- Re: Exception vs Boolean
- From: Cor Ligthert [MVP]
- Re: Exception vs Boolean
- From: Jon Skeet [C# MVP]
- Re: Exception vs Boolean
- Prev by Date: Re: Exception vs Boolean
- Next by Date: Re: Exception vs Boolean
- Previous by thread: Re: Exception vs Boolean
- Next by thread: Re: Exception vs Boolean
- Index(es):
Relevant Pages
|