K
Kenny Cutter
Hi group,
I am quite new to exceptions in .NET and I am a bit confused of how to
use the inner exceptions. Could anyone explain? Let's say I have a
function that takes a double (X) that is not supposed to be less or
equal to zero. Let's call this function DoSomething.
Also let's say that this function in turn calls another function doing
something with X.
Then if there is a bug in the DoSomething function that causes the
other function to throw an ArgumentOutOfRangeException.
void DoSomething(double X)
{
if(X<=0)
throw new ArgumentOutOfRangeException("X","X has to be greater
than zero");
X-=10; // This is a bug..
AnotherFunction(X);
}
void AnotherFunction(double X)
{
if(X<=0)
throw new ArgumentOutOfRangeException("X"," X has to be
greater than zero ");
I am quite new to exceptions in .NET and I am a bit confused of how to
use the inner exceptions. Could anyone explain? Let's say I have a
function that takes a double (X) that is not supposed to be less or
equal to zero. Let's call this function DoSomething.
Also let's say that this function in turn calls another function doing
something with X.
Then if there is a bug in the DoSomething function that causes the
other function to throw an ArgumentOutOfRangeException.
void DoSomething(double X)
{
if(X<=0)
throw new ArgumentOutOfRangeException("X","X has to be greater
than zero");
X-=10; // This is a bug..
AnotherFunction(X);
}
void AnotherFunction(double X)
{
if(X<=0)
throw new ArgumentOutOfRangeException("X"," X has to be
greater than zero ");