Can we throw exception from catch Block?
Answers were Sorted based on User's Feedback
Answer / deepika
The above answer is wrong.We can absolutely throw
exceptions in catch blocks.This is called bubbling the
exceptions to one level higher.If catch block can not
handle exceptions,then it can throw the exception that it
caught, to it's caller
Is This Answer Correct ? | 46 Yes | 1 No |
Yes. we can throw the exception from the catch block.
If anyone have confusion then try this code:
protected void Button1_Click(object sender, EventArgs e)
{
try
{
Test();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
private void Test()
{
try
{
throw new Exception("Dev");
}
catch (Exception ex)
{
throw ex;
}
}
Is This Answer Correct ? | 40 Yes | 2 No |
Answer / manee
we can throw the exception in catch block by using throw New
Exception("Exception Message")
Is This Answer Correct ? | 24 Yes | 2 No |
Answer / kakarala sowjanya
You can catch exceptions when the purpose of catching the
exception is to re-throw or transfer the exception to a
different thread. so we can throw exception from catch block
Is This Answer Correct ? | 22 Yes | 1 No |
Answer / kamlesh sharma
yes we can through exception If catch block can not
handle exceptions,then it throw the exception to it's
caller
Is This Answer Correct ? | 16 Yes | 2 No |
Answer / subbarao
i think answer is NO, because catch block is used to catch
the exceptions thrown
Is This Answer Correct ? | 9 Yes | 69 No |
Explain the life cycle of an ASP .NET page.
How to retrieve data row by row from a DataTable? Thanks In advance PriyaPP
If there is submit button in a from tell us the sequence what happens if submit is clicked and in form action is specified as some other page ?
How you can add an event handler?
Define tracing.
How we can set Different levels of Authentication in .Net? What are the difference between Windows Authenticatin, Passport Authentication and Form Authentication?
I have one .Net application and i have two databases which is in SQL server2000 and one more database in ORACLE? how can i access the database from different Databases?
What is base class of .net?
What is preprocessor in .net? Where it use?
benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks
Where do the cookie state and session state information be stored?
What is the use of asp.net web api?