Rendering exceptions as json with custom view

If i use restful routes and throw an exception, the error is parsed as json, and the response is something like:

    "message": "some exception",
    "url": "/users",
    "code": 500

But i use the cakephp-json-api plugin to render the results as json. If i throw an exception, the error is rendered as html. What i whant is to render as json too.

To handle the request, i use:

$this->RequestHandler->config('viewClassMap.jsonapi', 'JsonApi.JsonApi');
$this->RequestHandler->config('inputTypeMap.jsonapi', ['json_decode', true]);

I tried to debug the source code to figure out what is missing, but i failed.
Do anyone knows what else i need to do?