Implementing mail send on errors |
We have a web application used by several clients, and it would be useful if, upon specific errors happening in production environments (I was thinking errors of type critical, alert o emergency, if possible), the system would send us developers a quick email to let us know, and also retain the current behavior of showing an error page. I started by trying a custom exception exception handler (app/Libraries/CustomExceptionHandler.php)
PHP Code: <?php and I configured app/Config/Exceptions.php like PHP Code: public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface With, thus far, just an extra log_message or two to see that it was working. It does work, but what I see in the browser is not the normal exception trace for development or the error page for production, but an error "The error view files were not found. Cannot render exception trace." What am I missing? I tried leaving $viewPath as null or removing it from my custom class, but the error message about view files remains. Then I also read that I could add a custom Logger to send mail in the cases I need. What would be the best thing to do in my case? Best regards, |
Welcome Guest, Not a member yet? Register Sign In |