Kong EXIT Transformer

I am using Kong exit transformer in Kong API gateway and change the output status code based on body data condition (in config.function) but it is throwing error…Is this right plugin to change status code or I need to use response transformer…Please help me to fix this.

Wrote a code like this

Option-1

return function (status, body) if body.code==99 then status =404 end return status,body end

Option 2

return function (data) if data.code==99 then status =404 end return data end

But it is showing schema violation. I am not sure what is the error here. Please throw some light on this.

I have same error. did you find any fix? looks like docs are outdated