You can control value in RECORDS, FOUND but not ERRORCODE.
Use (global) field to return value.
There is no way to get the script result over XML or PHP. It just can't be done, so the only option is to set a field somewhere. I'd also suggest that you put in a feature request for this, I agree that it would be a very worthwhile addition to CWP.