Custom error messages for plugins

We want to use Kong to put in front of our API’s. Our API’s use a specific format for reporting errors to the API-users.

I’ve noticed that the response format from the plugins isn’t following any general line.
e.g. the OAuth plugin returns

{
    "error_description": "The access token is missing",
    "error": "invalid_request"
}

and the rate limiting plugin returns:

{
    "message": "API rate limit exceeded"
}

I would like these messages to be unified, and to follow my internal structure (makes it easier to parse for clients).

My internal structure, just for the sake of it:

{
	status: 429,
	message: "API rate limit exceeded",
	code: ECODEINTEXT
}

I would like to know if there is an easy way to customize the error messages of the plugins, without having to create all custom versions of the plugins.

My suggestion would be a different one: write a single custom plugin which transforms the responses. That is completely possible in Kong.

This would allow you to update the plugins you use without having to maintain your own forks.

Hi Kikito, Can you suggest or example about write plugin custom tranformation?

Hi everybody!, Is there any update about this issue?
Please, we have the same needs as @zetisam.
Thanks!