Here goes my alternate.
I am a C++ programmer. My goal is always to try to make code short and simple.
bool bFailed=false;
if (!bFailed) bFailed= condition1_fails;
if (!bFailed) bFailed= condition2_fails;
if (!bFailed) bFailed= condition3_fails;
if (bFailed) DoFailedCleanup();
else {
PerformActionOnAllSuccess();
DoNormalCleanup();
}
Pros
- Short and simple to read
- You can set debug breakpoints in any condition to test return values
- No functions / exceptions needed