You can factor out the error handling, so that your function can simply return on error. In C/C++ this would look something like this:
int handleError(int errorCode, char* message) { if(errorCode) { //Notify user, whatever } return errorCode; } int functionThatCanFail(...) { int result; if(result = handleError(do_stuff(), "do_stuff() failed")) return;return result; if(result = handleError(do_more_stuff(), "do_more_stuff() failed")) return;return result; } Of course, you can have a small set of such error handling functions to distinguish, for example, between fatal errors, errors and warnings or that handle different error returning conventions (error code vs. NULL pointer, for instance). In C++, the later differentiation can be handled by a template, but that's not a language agnostic consideration anymore.