Dear boost experts.

 

We are using boost::exception in a project of ours, and are trying to extract some information from an exception

to display to the user.

 

For example, diagnostic_information(e) returns this:

 

d:\projects\<project>\ClassName.cpp(376): Throw in function void __thiscall ClassName::CInetExceptionHandler<struct ClassName::BadLoginException>(class CInternetException *) const

Dynamic exception type: class boost::exception_detail::clone_impl<struct ClassName::BadLoginException>

std::exception::what: Unknown exception

[struct tag_implementation_ClassName_SpecificInfo_errstr *] = Error: 12014 Context: 0 Message: The password was not allowed

 

[struct tag_interface_CDataInterface_errstr *] = ClassName reports: Bad FTP login

 

 

What I want is to extract "Error: 12014 Context: 0 Message: The password was not allowed" or "ClassName reports: Bad FTP login"

from that exception.

 

However, these exceptions may be generated in DLLs that the main program know nothing about.

 

To simplify, here is what I do and want ot be happening:

 

1. Main program calls method in DLL

2. Main program knows this method can throw expections of type boost::exception

3. Main program catches such exception

4. Main program obtains string that is user-friendly from this exception

 

Has anyone acccomplished this or knows how to extract the information from above (ideally not by parsing the string?)

Alternatively, could I somehow fill the std::exception::what and then get that information out of boost::exception somehow?

 

 

Thanks everyone!

 

 


Mit freundlichen Grüßen / With best regards

Andreas Iwanowski - IT Administrator
www.awato.denamezero@afim.info
T: +49 (0)2133 2969 28 | F: +49 (0)2133 2969 69
awato Software GmbH | Salm Reifferscheidt Allee 37 | D-41540 Dormagen

avisor-Support | T: +49 (0)621 6094 043 | F: +49 (0)621 6071 447

awato Software GmbH 
Geschäftsführer: Ursula Iwanowski | HRB: Neuss 7208 | VAT-no.: DE 122796158