throw; redraws the exception itself, which is currently being processed, but does not exist in your code.
You need to quit something. Instead, try something like throw std::runtime_error("my message"); . To do this, you need to include #include <stdexcept> .
In real code, you'll want to create your own exception class to throw the most likely
source share