Yii REST - Change exception response format

Hello,

I am using Yii REST setup, however I’m struggling to change the way responses are being handled by Yii.

A general Not Found response looks like the following:


{"name":"Not Found","message":"Page not found.","code":0,"status":404,"type":"yii\\web\\NotFoundHttpException"}

Currently I was able to achieve it to always return a JSON response, however I need to be able to customize the response, as for example I don’t want to pass the Exception type, or at least not in the shown type, as I don’t want to mention that I am using Yii to the public.

Possibly I would need to extend a class to achieve that, however I wasn’t able to find out what should I extend and where should I define that I’m using a new class.

Thanks!

Why not using this: http://www.yiiframework.com/doc-2.0/guide-rest-error-handling.html#customizing-error-response and simply remove the keys from $response->data as needed ?