Q: Why try catch cannot catch the exception 
Author Message
 Q: Why try catch cannot catch the exception

Dear everyone:
    I encountered a very strange question: a statement block enclosed by
try{}catch(...) still raise error, the error message is as follows:
    Unhandled exception in myprog.exe(Kernel32.dll) 0x000006BA:(no name)

    Did any experienced programmer has ever had such a problem?

    Can you give me some hints?

    Sincerely Yours
    Richard Huang



Mon, 02 Jun 2003 18:31:28 GMT  
 Q: Why try catch cannot catch the exception
Hi,
This looks like a mem violation. Those are hard to catch.
A *catch* only works if an exeption is thrown, (in this case it's not).
Show us the code between the try and we will have a look at it.

Florent



Quote:
> Dear everyone:
>     I encountered a very strange question: a statement block enclosed
by
> try{}catch(...) still raise error, the error message is as follows:
>     Unhandled exception in myprog.exe(Kernel32.dll) 0x000006BA:(no
name)

>     Did any experienced programmer has ever had such a problem?

>     Can you give me some hints?

>     Sincerely Yours
>     Richard Huang

--
See http://www.myoddweb.com

Sent via Deja.com
http://www.deja.com/



Mon, 02 Jun 2003 18:55:32 GMT  
 Q: Why try catch cannot catch the exception


Fri, 19 Jun 1992 00:00:00 GMT  
 Q: Why try catch cannot catch the exception
Have you tried to use system exceptions ( structured exception handling )
using __try and except
handlers.....?

Quote:
> Dear everyone:
>     I encountered a very strange question: a statement block enclosed by
> try{}catch(...) still raise error, the error message is as follows:
>     Unhandled exception in myprog.exe(Kernel32.dll) 0x000006BA:(no name)

>     Did any experienced programmer has ever had such a problem?

>     Can you give me some hints?

>     Sincerely Yours
>     Richard Huang



Mon, 02 Jun 2003 21:42:38 GMT  
 Q: Why try catch cannot catch the exception

Quote:
> Dear everyone:
>     I encountered a very strange question: a statement block enclosed by
> try{}catch(...) still raise error

Does the code inside the try block call a function with exception specifiers?

The situation you describe could occur in this case:

void foo() throw(abc)
{
     throw xyz;

Quote:
}

void bar() // your function
{
      try {
          foo();
      } catch (...) {
       // won't get here
      }
 }

If a function has an exception specification (the 'throw(abc)') and throws an
exception that is not listed in that specification, the system will call
unexpected() which would cause the results you're seeing.

See Scott Meyers's "More Effective C++", p. 77.



Tue, 03 Jun 2003 01:08:53 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. why {try catch} does not catch

2. TRY-CATCH vs. try-catch

3. try/catch VS TRY/CATCH

4. Can you catch CDBExection with try-catch keyword?

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

6. Does Finally execute try Catch throws an Exception?

7. Trying to catch exception

8. try-catch(...) exceptions

9. Exception handlng with try and catch

10. Cannot catch stack overflow exception.

11. Does eVC support try, catch exceptions

12. try/catch exception handling question.

 

 
Powered by phpBB® Forum Software