Skip to content

Instantly share code, notes, and snippets.

@alfian0
Last active August 24, 2018 14:22
Show Gist options
  • Save alfian0/dacef236fa4b3d7d146a6a2a53c1a081 to your computer and use it in GitHub Desktop.
Save alfian0/dacef236fa4b3d7d146a6a2a53c1a081 to your computer and use it in GitHub Desktop.
function() {
HRESULT error = S_OK;
if (SUCCEEDED(Operation1()) && SUCCEEDED(Operation2()) && SUCCEEDED(Operation3()) && SUCCEEDED(Operation4())) {
return S_OK;
} else {
return OPERATIONFAILED;
}
}
function() {
HRESULT error = S_OK;
if(SUCCEEDED(Operation1())) {
if(SUCCEEDED(Operation2())) {
if(SUCCEEDED(Operation3())) {
if(SUCCEEDED(Operation4())) {
} else {
error = OPERATION4FAILED;
}
} else {
error = OPERATION3FAILED;
}
} else {
error = OPERATION2FAILED;
}
} else {
error = OPERATION1FAILED;
}
return error;
}
function() {
if (!SUCCEEDED(Operation1())) {
return OPERATION1FAILED;
}
if (!SUCCEEDED(Operation2())) {
return OPERATION2FAILED;
}
if (!SUCCEEDED(Operation3()) {
return OPERATION3FAILED;
}
if (!SUCCEEDED(Operation4())) {
return OPERATION4FAILED;
} else {
return S_OK;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment