I've seen that JSCocoa allows to do this using an outArgument:
var error = new outArgument
if (![headerString writeToFile:headerFile atomically:true encoding:NSUTF8StringEncoding error:error]) {
log("error" + error.outValue)
}
but this doesn't seem to work in JSTalk. Is it possible to do something like this?