Which of the two exceptions was called?
Posted
by Rob
on Stack Overflow
See other posts from Stack Overflow
or by Rob
Published on 2010-05-17T14:51:18Z
Indexed on
2010/05/17
15:00 UTC
Read the original article
Hit count: 150
If I have a routine that can throw an ArgumentException in two places, something like...
if (Var1 == null)
{
throw new ArgumentException ("Var1 is null, this cannot be!");
}
if (Val2 == null)
{
throw new ArgumentException ("Var2 is null, this cannot be either!");
}
What’s the best way of determining in my calling procedure which of the two exceptions was thrown?
Or
Am I doing this in the wrong fashion?
© Stack Overflow or respective owner