Exception Handling 
Author Message
 Exception Handling

I am trying to create a generic exception handling class. I have been able
to do this except for one small thing.

What I want to do is provide a string the represents the type of exception
that occured. (based on the value of "ExceptionCode" in the
ExceptionRecord.)

For example: EXCEPTION_INT_DIVIDE_BY_ZERO means "The process attempted to
divide an integer value by an integer divisor of zero."

I can hard code these strings no problem, but I would like to find a way of
using a system supplied string if possible. Say with a function like
FormatMessage().

This is not an MFC application so I would prefer to find a method that does
not require MFC.

Any ideas would be very much appreciated.

Thanks in advance.
Bill



Tue, 07 Jun 2005 23:40:55 GMT  
 Exception Handling
have you tried to use  _set_se_translator  function


Quote:
> I am trying to create a generic exception handling class. I have been able
> to do this except for one small thing.

> What I want to do is provide a string the represents the type of exception
> that occured. (based on the value of "ExceptionCode" in the
> ExceptionRecord.)

> For example: EXCEPTION_INT_DIVIDE_BY_ZERO means "The process attempted to
> divide an integer value by an integer divisor of zero."

> I can hard code these strings no problem, but I would like to find a way
of
> using a system supplied string if possible. Say with a function like
> FormatMessage().

> This is not an MFC application so I would prefer to find a method that
does
> not require MFC.

> Any ideas would be very much appreciated.

> Thanks in advance.
> Bill



Thu, 09 Jun 2005 04:14:06 GMT  
 Exception Handling
William,

Quote:
>For example: EXCEPTION_INT_DIVIDE_BY_ZERO means "The process attempted to
>divide an integer value by an integer divisor of zero."

>I can hard code these strings no problem, but I would like to find a way of
>using a system supplied string if possible. Say with a function like
>FormatMessage().

The system's message table resource doesn't have the definiton for the
exception error codes.
You can create your own message definiton and pass it to FormatMessage.
Or you could bypass the FormatMessage API and implement the Convertion on
your own.
The following article (eventhough a bit old) demonstrates  converting
exception codes to string messages.

167802 EXCEPTEX Traps MFC and Win32 Structured Exceptions
http://support.microsoft.com/?id=167802

Hope this helps get you started.

Thank you,
Bobby Mattappally
Microsoft VC++/C# Team

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------

Quote:

>Subject: Exception Handling
>Date: Fri, 20 Dec 2002 10:40:55 -0500
>Lines: 23

>For example: EXCEPTION_INT_DIVIDE_BY_ZERO means "The process attempted to
>divide an integer value by an integer divisor of zero."

>I can hard code these strings no problem, but I would like to find a way of
>using a system supplied string if possible. Say with a function like
>FormatMessage().

>This is not an MFC application so I would prefer to find a method that does
>not require MFC.

>Any ideas would be very much appreciated.

>Thanks in advance.
>Bill



Sat, 11 Jun 2005 07:13:23 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Crash In Exception Filter in Structured Exception HAndling

2. Floating Point Exceptions: MFC or Structured Exception Handling?

3. Exceptions : Combining C++ and Structured Exception Handling ?

4. Exception handling - how to know which exceptions are thrown

5. Exception handling question

6. /Og and exception handling in VC++7

7. Exception Handling in VC 7.1 Beta?

8. Exception handling

9. exception handling in threads

10. C++ Inherited Exception Handling

11. ANNOUNCE: CEXCEPT - Exception Handling in C

12. CEXCEPT - Exception Handling in C

 

 
Powered by phpBB® Forum Software