-
-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Email or Log Exceptions #133
Comments
Showing an error page to the user can't really be our responsibility. $run->pushHandler(function($exception, $inspector, $run){
http_response_code(500);
echo file_get_contents('my500.html');
}); For logging errors we could have created an Finally, sending a pretty email is a good idea, I've added it to the requested features list. |
👍 I would like a pretty email generator. |
👍 EmailHandler would be great. |
I think this is something that would be better handled by each user, and not by whoops. For example, laravel users may which to use the laravel mail component. |
@GrahamCampbell Even if we used the Laravel mail component, it would be nice of Whoops produced the pretty HTML for us and then gave us a callback so that we can send it. |
Yeh, that would be nice. |
If I could star @mnbayazit's reply, I would have starred it over a million times. I'm currently in the process of writing a custom error handler for our projects, and would like to send the pretty html as an attachment to our ticketing system. A callback like that would be most excellent! |
I fully agree and would support a pull request implementing that. |
Can we reopen this? Currently in our project we are doing: $this->whoops->pushHandler(function($exception, $inspector, $run) {
// Truncated.... we email our error here
return \Whoops\Handler\Handler::DONE;
}); Are there any code samples for hooking into the pretty page handler and:
|
Given that there are many ways to send emails in PHP (in my team's project, we use I think providing some means of hooking into the response from |
It’s not an issue, it’s a feature request. Until someone contributes the feature in a PR there’s no value in keeping the issue open. A PR is welcome, albeit for this feature a discussion in advance would be appreciated. |
@denis-sokolov : Perhaps open this and label it a feature request? Lots of projects follow this pattern as it increases transparency. I had to do a bit of digging to find this page: https://github.com/filp/whoops/wiki/Possible-features-to-add |
It’s a matter of preference. In Whoops not keeping tens of feature request allows us to keep track of actual issues. |
For anyone else interested in this, I managed it as follows:
$body contains the html page as a string, so can be emailed or used however you wish |
I'm using Slim and I have no idea how to get the PrettyPageHandler body. |
see e.g. https://github.com/redaxo/redaxo/blob/b4da95c603024e660d5686351797e53c96f11a42/redaxo/src/core/lib/error_handler.php#L62-L74 in which we retrieve the contents from the handler as a string. (its the same code like the one above in the comment though) |
For anyone that wants to use Julusian's approach in a CLI application like I am, you'll need to set handleUnconditionally to true.
|
Just found this and i was thinking It would be nice to have on a production machine, that an Exception handled by
-just showing an Error page (500 or similar) to the user
-then log the exception locally
-or email something like the PrettyPageHandler output to an Email address.
The text was updated successfully, but these errors were encountered: