convertOutvarsToCapture function

Convert outvars argument to capture. Variables that are already in error block will be discarded.