Обработка исключений

#include <iostream>
#include <stdexcept>
using namespace std;

void methodWithException() {
    try {
        throw runtime_error("test exception");
    }
    catch (exception & e) {
        //implementation of any partial processing
        //and send error to the calling code
        throw;
    }
}

try {
    methodWithException();
}
catch (runtime_error & e) {
    cout << e.what();
}