whoops
php errors for cool kids
whoops! - php errors for cool kids whoops is a php library that helps you deal with errors
I'd like to insert a code snippet into Laravel's error pages, but I can't figure out how to modify or capture the output.
This filthy hack seems to work, but the snippet is inserted before any page code.
// In laravel/app/start/global.php
App::error(function (Exception, $exception, $code)
{
echo '<script src="//localhost:35729/livereload.js"></script>';
});
Source: (StackOverflow)
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();
Source: (StackOverflow)
My Homestead Vagrant virtual machine is returning me a 502 Bad Gateway
instead of a Laravel Whoops error for some PHP errors (like class not found, some kind of parse errors etc ...).
Does someone have the solution for briging Whoops for all PHP errors ?
I could get the error reading manually /var/log/nginx/<my_vhost>.app-error.log
like this :
2014/11/27 15:15:44 [error] 1300#0: *12 FastCGI sent in stderr: "PHP message: PHP Fatal error: <ERROR HERE> on line <LINE>
But it is very annoying for debugging ...
Homestead version : 0.2.0.
Laravel version : 4.2
Source: (StackOverflow)
I am in need of having try-catch blocks inside my business logic. Thereby I can do some logging of the error with some more context.
try {
// business logic
} catch(Exception $e) {
// Log message like 'Could not create user with email something@domain.com'
$msgForUser = CustomErrorHandler::handleError($e, $data->email);
// Display message like 'Your user was not created bla bla bla'
return $msgForUser;
}
I realise I could setup custom error handling in App::error
in start/global.php
, however this removes the opportunity of including variables and messages specific to that function.
The problem is that now my try blocks catches errors in development. And I would like to still get the Whoops exception debugger in development mode. Is this possible?
Source: (StackOverflow)
This might be a stupid question but I can't really see it in the documentation: is there a config variable (ideally) or an unobtrusive way to add a callback into Whoops (specifically the PrettyPageHandler
) so that each frame has its arguments in the info detail area on the right? I'd rather not have to basically copy-and-edit PrettyPageHandler
just to get it in because I don't want to have issues if I update my version of Whoops in the future.
I've looked into adding a handler to the stack to modify each frame by adding its arguments as a frame comment but ran into problems immediately. Either one of the following is happening:
Whoops's PrettyPageHandler
doesn't show frame comments. Assuming my handler is correctly adding some text to the comment section (I've tried it with just a string rather than trying to get the args list) when I place the handler before the PrettyPageHandler
in the stack, then PrettyPageHandler
isn't showing the comments.
or
Whoops can't handle multiple handlers actually doing anything:
- If I add my handler first, nothing appears to be different (see point 1 above, though)
- If I add it last I get no Whoops output at all
From the documentation it looks like there's a way to get the arguments from a given frame (see Frame::getArgs()
), but it would appear that as yet Whoops does not have this implemented in its default handler, or at least not that I can see.
Am I right in that this is pretty much not currently possible without making a whole PrettyPageHandler
of my own or am I missing something pretty obvious?
Source: (StackOverflow)
In laravel 4, the debug error pages is very useful. It uses whoops library. I am wondering, is it possible to get values of local variables in the error pages? I mean It could display the arguments and the other local variables (by var_dump) for every frame. If it does it would be very useful.
Source: (StackOverflow)
Most of the time i am getting
"htmlspecialchars() [<a rel='nofollow' href='function.htmlspecialchars'>function.htmlspecialchars</a>]: Invalid multibyte sequence in argument"
in laravel even for syntax error. I didnt understand and I am unable to track the actual error.
How can i track the actual error in laravel 4
Source: (StackOverflow)