Reputation: 1048
I am currently coding pages that will be executed by cronjobs so no real users will have access to them. In development I am using Whoops to debug my errors/exceptions.
I am not using Laravel any another framework. When I commit my code to the production environment how can I email these errors/exceptions to myself, instead of them being handled by Whoops which no one will be able to see anyway?
All I currently do is initiate Whoops
$whoops = new WhoopsRun();
$handler = new WhoopsPrettyPageHandler();
$whoops->pushHandler($handler)->register();
Upvotes: 2
Views: 933
Reputation: 1186
You would want to use a callback handler.
$whoops = new WhoopsRun();
$handler = new WhoopsCallbackHandler(function($exception, $inspector, $run) {
//send an email
});
$whoops->pushHandler($handler)->register();
It looks like you are using use statement aliases so I matched your format, but the class is called Whoops\Handler\CallbackHandler.
Upvotes: 1