I'm fairly new to PHP and I've been working on a web application where I'm using templates to render my views. However, I'm facing some issues when it comes to handling exceptions that are thrown during template rendering or view rendering.
Basically, when an exception occurs in my code while rendering a template or a view, I'm not sure how to properly handle it. I want to make sure that any errors or exceptions are caught and handled gracefully, without the user seeing a page full of error messages.
I've done some research on exception handling in PHP, but most of the examples and explanations I found focus on general exception handling, and don't specifically address exceptions thrown during template rendering or view rendering.
So, I was wondering if any of you could provide some guidance on how I can handle exceptions thrown during template rendering or view rendering in PHP? How should I catch these exceptions and display user-friendly error messages instead?
Any help or advice would be greatly appreciated. Thanks in advance!