#include using namespace std; class except1 {}; class except2 {}; void someFunction() { try { throw except1(); } catch(const except1& e) { cout << "catched at someFunction\n"; cout << "rethrowing\n"; throw except2(); // this will be catched at main not here } catch(const except2& e2) { cout << "this wont be printed\n"; } } int main(int argc, char* argv[]) { try { someFunction(); } catch(const except2& e) { cout << "catched at main\n"; } } /*output: catched at someFunction rethrowing catched at main */