I assume that you mean that you throw away the derived type and any data that it stores. You cannot do this as a general solution. Of course, if you use the Foo library, and it often raises a FooError, you can catch (const FooError& e)also handle it on purpose.
You can also use RTTI to detect the type of runtime of the exception and add this to the exception. Net. The name that appears is somewhat ugly.