test the typeid of the exception before it is potentially moved