error handling ex1
🧩 Syntax:
int f2(); // error handling of f2() is along the lines of f1()
int f3(); // error handling of f3() is along the lines of f1()
int f1() {
int ret = 0;
try {
if(f2() == ERROR) {
// <log error message stored somewhere else>
throw 1;
}
if(f3() == ERROR) {
// <log error message stored somewhere else>
throw 1;
}
}
catch(const int& err) {
ret = err;
}
return ret;
}