Boost logo

Boost Users :

Subject: [Boost-users] Extracting "friendly" information from boost::exception
From: Andreas M. Iwanowski (namezero_at_[hidden])
Date: 2012-07-21 17:50:28


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.de<http://www.awato.de> | namezero_at_[hidden]<mailto:namezero_at_[hidden]>
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] [cid:qrCode-58869986-5cab-4997-b473-f0c11a0058ad21bff0]
Gesch?ftsf?hrer: Ursula Iwanowski | HRB: Neuss 7208 | VAT-no.: DE 122796158




qrCode-58869986-5cab-4997-b473-f0c11a0058ad21bff0

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net