web::http::http_exception does not set std::exception's _Mywhat value

Feb 17, 2015 at 6:30 PM

I noticed when writing some exception handling code that I don't get any useful data when catching an std::exception and using it's what() member. Catching the http_exception worked fine and .what() returns useful info.

Is there a reason the http_exception constructors can't invoke the std::exception() to allow std::exception::what() to return the same info?

Thank you
Feb 17, 2015 at 6:45 PM
Hi Furunaka,

There is no std::exception constructor in the C++ standard the takes a string, take a look here. Are you catching your the exception by value, and therefore slicing the object? It sounds like this might be your problem. Try catching by const reference and see if all the data is correct.

Feb 17, 2015 at 7:10 PM

Yes, I was not catching by reference which broke up the object and the virtual what() call. Thanks!