Hi Amrutha,
Its not a good practice to re-throw an error so please avoid it.
What you required to do when a error occurred there are several ways to handle it but you should know whats the actual requirement is.
In your case I think enum will do the trick.
Create a enum
public enum ErrorTypes
{
NoError=0,
SQL=1,
Logical=2,
Data=4,
ErrorUndefine=8
}
public bool LogIn ([Your parameters],out ErrorTypes Error);
Now put try catch block in Business and Data Layer Like
try {
}catch(Exception ex)
{
Error=ErrorUtil.SetErrorType(ex);
}
public class ErrorUtil
{
public static ErrorTypes SetErrorType(Exception ex)
{
if(ex is SQLException)
{
return ErrorTypes.SQL;
}
}
}
But always remember that its better to check validity of data rather that waiting for a run time error.
Thanks
Suvabrata