I do a simple throw \"TEST THROW\" and it isn\'t caught in my catch (std::exception& e). Is it because I\'m catching an std::exception& e?
You're throwing a const char*
. std::exception
only catches std::exception
and all derived classes of it. So in order to catch your throw, you should throw std::runtime_error("TEST THROW")
instead. Or std::logic_error("TEST THROW")
; whatever fits better. The derived classes of std::exception
are listed here.