i'm writing a class library having following code snippet. i want this class
to report an error (by throwing an Exception) to the application using this
class library. the problem is that within that try block there are several
exceptions that this class itself needs to handle (interrnally). now when
the exception, UserAlreadyRegistered, is thrown the class' catch block
(within library) catches it and no exception is thrown to the application
further using it.
for this in catch block i have put up another throw instruction if the
exception occured was "UserAlreadyRegistered" in order to pass the exception
to the application.
let me know if there's some better way to do it....and plus what is
"InnerException" supposed to do????
try
{
if (this.IsRegistered(userInfo.EmailAddress))
throw new Exception("UserAlreadyRegistered"); // the exception
supposed to be caught by application using this class
// code goes on
}
catch (Exception exp)
{
if (exp.Message=="UserAlreadyRegistered")
throw exp;
// some exception handler
}
thanks.
Farooq Khan