@carbonera Cake’s detailed error pages are only shown when debug in on. In production when you turn off debug all exceptions are converted to 404 or 500 errors. So you just need to customize the two template files in src/Template/Errors. https://github.com/cakephp/app/tree/master/src/Template/Error
I found the “solution”
I put an back slash before the Exception, so, this way I could use the php’s Exception instead of the cake’s Exception. I know that in my example I have put the back slash, but I haven’t do it in all places.