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


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.