try { BOOST_THROW_EXCEPTION(std::invalid_argument("Blah")); } catch (...) { boost::exception_ptr exception = boost::current_exception(); try { boost::rethrow_exception(exception); } catch() //exception is from std::invalid_argument do i need to give boost::excepion &e or std::exception &e in catch block My application code is having boost::exception and std::exception. I need a datatype to store both std::exception and boost::exception(other than boost::exception_ptr as everytime I need to rethrow and catch it and need to do everythng inside cathc block.. its not possible always) On Mon, 18 Oct 2021 at 16:48, rajesh daggumati < rajeshdaggumati9999@gmail.com> wrote:
try { BOOST_THROW_EXCEPTION(std::invalid_argument("Blah")); } catch (...) { boost::exception_ptr exception = boost::current_exception(); try { boost::rethrow_exception(exception); } catch() //exception is from std::invalid_argument do i need to give boost::excepion &e or std::exception &e in catch block
My application code is having boost::exception and std::exception. I need a datatype to store both std::exception and boost::exception(other than boost::exception_ptr as everytime I need to rethrow and catch it and need to do everythng inside cathc block.. its not possible always)
On Sun, 17 Oct 2021 at 21:40, rajesh daggumati < rajeshdaggumati9999@gmail.com> wrote:
My application code was handled with shared_pointers. here boost::rethrow_exception is throwing exception object (which is created in stack..) but shared pointers need objects which are created on heap SO for that , I am converting object from stack to heap by copying it.(ie. classname *c1 = new classname(stack_object)). I have typecasted all std::exceptions I have two queries 1. I need some class whose 2 childs are std::exception and boost::exception so that I can type cast based on if checks.. 2. The exception classes which are in boost::exception and not in std::exception
Please help me to clarify above 2 queries.
On Sun, 17 Oct 2021 at 19:44, Vinnie Falco
wrote: On Sun, Oct 17, 2021 at 6:47 AM rajesh daggumati via Boost
wrote: ...
I don't know exactly what is going on here, but I am having trouble seeing the necessity. Maybe you could explain exactly what you are trying to do, because this business of doing all these casts is not something that I have seen before. Is it possible that this function could be helpful to you?
https://en.cppreference.com/w/cpp/error/make_exception_ptr
Regards