The if ~ else block in try~catch block 
Author Message
 The if ~ else block in try~catch block

Hi, have you encounter something like this:

   try{
       if( expression )
          A;
       else
          B;
   }
   catch(Exception e)
   { ... }

BOTH A & B was execute!
Can you tell me what wrong with my code?
TIA!



Fri, 22 Apr 2005 13:50:13 GMT  
 The if ~ else block in try~catch block
Have a code example I could look at, it all seems fine otherwise...


Quote:
> Hi, have you encounter something like this:

>    try{
>        if( expression )
>           A;
>        else
>           B;
>    }
>    catch(Exception e)
>    { ... }

> BOTH A & B was execute!
> Can you tell me what wrong with my code?
> TIA!



Fri, 22 Apr 2005 17:42:36 GMT  
 The if ~ else block in try~catch block
...it seems alright to me; you might want to check your
conditional expression and simply put the if ~ else
statements in code blocks as well.

Regards, Raphael
www.ilohraphael.net

Quote:
>-----Original Message-----
>Hi, have you encounter something like this:

>   try{
>       if( expression )
>          A;
>       else
>          B;
>   }
>   catch(Exception e)
>   { ... }

>BOTH A & B was execute!
>Can you tell me what wrong with my code?
>TIA!

>.



Fri, 22 Apr 2005 20:32:26 GMT  
 The if ~ else block in try~catch block
Do they both execute or does it just appear that the de{*filter*} steps into B
after A.  There was a know bug in the de{*filter*} display that I believe was
fixed in SP2 that would cause items to appear to be selected for execution
even though they didn't actually get run.

Ron Allen

Quote:
> Hi, have you encounter something like this:

>    try{
>        if( expression )
>           A;
>        else
>           B;
>    }
>    catch(Exception e)
>    { ... }

> BOTH A & B was execute!
> Can you tell me what wrong with my code?
> TIA!



Fri, 22 Apr 2005 22:50:27 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Why am I seeing such a delay between my catch block and my finally block

2. Overhead of try-catch blocks?

3. does atl support try..catch block?(empty inside)

4. try catch block

5. Optimizer ignores try-catch block

6. /Og causes intermittent omission of try..catch block

7. nested try/catch block and _set_se_translator

8. try{} catch{} block and Global Optimization

9. Error processing using try-catch blocks

10. can I nest try/catch blocks?

11. Catching Win32 exceptions with a C++ catch-block

12. Try catch blocks - can multiple methods share a single try/catch combination?

 

 
Powered by phpBB® Forum Software