[exception] Passing existing exception hierarchies between threads

Hi, I am trying to pass Poco::Exeption from worker thread to a client thread/future. Idea is simple: try { operationThatMyThrowPocoException(); } catch (const Poco::Exception& e) { // rethrow with exception_ptr support so can be passed between threads BOOST_THROW_EXCEPTION(e); } but this causes compilation error because Poco::Exception defines clone() method on its own: error C2555: 'boost::exception_detail::clone_impl<T>::clone': overriding virtual function return type differs and is not covariant from 'Poco::Exception::clone' c:\devel\boost_1_50_0\boost\exception\exception.hpp 468 Is there a way to use BOOST_THROW_EXCEPTION / enable_current_exception() with existing exception hierarchies that define clone() already? Regards, Szymon -- Szymon Gatner The Lordz Games Studio www.thelordzgamesstudio.com

On Mon, Jul 2, 2012 at 3:13 AM, Szymon Gatner
I am trying to pass Poco::Exeption from worker thread to a client thread/future. Idea is simple:
try { operationThatMyThrowPocoException(); } catch (const Poco::Exception& e) { // rethrow with exception_ptr support so can be passed between threads BOOST_THROW_EXCEPTION(e); }
You understand that the above code will erase the type of the exception object in case what got thrown initially is of type that derives from Poco::Exception, right?
Is there a way to use BOOST_THROW_EXCEPTION / enable_current_exception() with existing exception hierarchies that define clone() already?
Probably not. If your exceptions can already be cloned, you can clone them that way. Emil Dotchevski Reverge Studios, Inc. http://www.revergestudios.com/reblog/index.php?n=ReCode
participants (2)
-
Emil Dotchevski
-
Szymon Gatner