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 |
How can I open ashx file in mobile?
How do you access individual items of an Master Page
What is the difference between web config and machine config files?
ASP.NET uses event driven programming model.Justify.
How response object is related to asp's response object?
what is value type to reference type
6 Answers AG Technologies, IBM,
How to merge 2 tables fields in DataTable in asp.net
What is the purpose of session management?
What is the difference between mechine.config and web.config?
What is clickid?
How to manage different kinds of sessions in ASP.NET?
What are the namespaces used in asp.net mvc? : asp.net mvc