Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Try-Catch and how throw work in catch block

Tags:

try-catch

I have question about throw. How will the throw work in the following code? Does the catch block return false?

try
{
    //code
}
catch(Exception ex)
{
    throw;
    return false;
}
like image 205
Novice Developer Avatar asked Dec 03 '22 14:12

Novice Developer


1 Answers

No, it rethrows. Somewhere up the call stack needs to catch it.

The return false is never reached.

like image 159
Lou Franco Avatar answered Apr 12 '23 11:04

Lou Franco