By the time Cake is displaying the error it should already be too late to do something about it. Not quite sure why you'd get an error about missing models when you change the viewPath
, I hope that was just an example.
You might have some luck overriding or extending the ErrorHandler
to intercept errors, but I wouldn't recommend doing that. Errors don't exist to be hidden, they're there to tell you something.
Creating a custom View might be a good idea depending on what you want to do (see the MediaView as an example of an alternative view).
The best thing to do though should be to avoid triggering errors by only allowing certain, predefined views to be set or making sure that a certain view file exists before trying to invoke it.