Improve handling of errors
Hello,
First of all, thanks for this project. We use CPPtrace in our software under windows (with dbghelp), for better tracing in case of particular events (for instance).
Sometimes when we ask for a trace, the get_frame_object_info fails and go into src/binary/object.cpp line158 to do :
std::fprintf(stderr, "%s\n", std::system_error(GetLastError(), std::system_category()).what());
This is a problem for us as it goes into the stderr shared across the whole program and cause users to wonder what this error is and where do it come from (and more importantly : is it serious ?).
For instance this is the kind of message we get :
Le module spÚcifiÚ est introuvable.
which should translate to The specified module cannot be found. .
Could we imagine that instead of calling a naked std::fprintf, we provide a callback to log/handle the errors of this kind accordingly ?
Thanks and best regards
Hi, thanks for opening this and sorry you ran into this. It would definitely be better for cpptrace to not print stuff like this. I’m not sure the best way for cpptrace to report its own internal errors, I think some sort of logging callback could be reasonable. For the time being removing the print is straightforward and I’ll do so as well as looking for anywhere else in the codebase this is done.
I've released the next version of cpptrace with better handling here