How about separating check and handle as follows:
- 
handlecan just works likedeferas the draft suggested(called after return in reversed order of definition), and the magic identifiererrcould be changed to any error varible decalared, not the result ofcheck.
- 
The error result as the last return value of a function should not be omitted in the presence of check.
- 
The return statements in handlejust return thehandlescope, not the function scope.
- 
Restrict functions to use named result parameters when using check.