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 |
Urgent requirement of .NET in CMMI Level3 COmpany Pune
What is the difference between Postback and Ispostback Property?
7 Answers Atrocity Apps Technologies, DC Infotech, HCL, Maples, Visual Soft,
What does the following SQL statement return, assuming that all tables and column names are correct? SELECT FirstName, StreetAddress FROM Employees JOIN AddressBook ON Employees.EmpID = AddressBook.EmpID a) Nothing, the JOIN syntax is wrong. b) All the records form the Employees table, and only the matching ones form the StreetAddress table. c) All the records from the StreetAddress table and only the matching records form the Employees table. d) Only the matching records from the two tables.
Which .NET framework supports Web API?
What is a master page and what does it do?
How does dataset acts in a disconnected fashion ?
What is difference between web api and web services?
What is a viewstate?
Explain weak typing and strong typing.
Which data types are supported by the RangeValidator control?
What are the differences between the response.write() and response.output.write()?
Differences between VB.Net and C#, related to OOPS concepts
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)