Feb 5, 2008

Exception handling

Such a nice method of C++ exception handling in big projects.

void handleException() {
try {
throw;
} catch (const Exception1& ex) {
handleException1(ex);
} catch (const Exception2& ex) {
handleException2(ex);
}
}

void foo1() {
try {
...
} catch (...) {
handleException();
}
}

void foo2() {
try {
...
} catch (...) {
handleException();
}
}

(has been taking from wxWidgets library)

No comments: