-
Notifications
You must be signed in to change notification settings - Fork 50
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
Making bullet work with Whoops exception library #38
Comments
Looks like a very helpful library for debugging. I checked into it a bit. What happens when you set the $whoops->writeToOutput(true); |
yeah, it's quite useful. I did some work with Laravel and he has it built in as the default exception handler in debug mode (which is a configuration setting). I tried $whoops->writeToOutput(true); but the results were the same. I have been looking at this off and on for a couple of days and am baffled ;) |
Okay. There is some built-in exception handling in Bullet. You may have to do something in there: $app->on('Exception', function($request, $response, \Exception $e) {
// ...
var_dump($e);
}); |
still no luck but thanks for the note about the exception handling. I see you are using |
Either pass the exception directly to Whoops: $app->on('Exception', function($request, $response, \Exception $e) use ($run) {
$run->handleException($e);
}); or restor the Whoops handler: $run->register();
... $app ...
restore_exception_handler(); |
You can also register Whoops at the very end. |
ok it's working. I am using the following code (as suggested above): <?php
require '../vendor/autoload.php';
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
$whoops->register();
// Your App
$app = new Bullet\App();
$app->on('Exception', function($request, $response, \Exception $e) use ($whoops) {
$whoops->handleException($e);
});
$app->path('/', function($request) {
return $blah;
});
echo $app->run(new Bullet\Request()); @denis-sokolov - I notice that before the pretty formatting was working, my stack dump had 5 items but now that I have it working, there is just Thanks for your help both of you! |
I don't know, what's your error? |
I was just testing it so I returned an undefined var to throw the exeception... I guess I could have done something more meaningful. The previous stack trace was in my OP |
is it because your not defining blah in your code? i dont see it in the code above.... |
@sam2332 yes, I was trying to trigger an error to test the @vlucas you can close this issue as I now have whoops working in bulletphp and the solution is in my post above. |
This is more of a question than an "issue" ;)
I was interested in getting
BulletPHP
working with theWhoops
https://github.com/filp/whoops exception library.The code I tried so far was:
This appears to work, in that it gives me a stack dump, seemingly Whoops-generated as so:
but it's just that dump... no pretty page, no HTML at all. The dump pasted above is from the
view source
in the browser so it's only dumping the text itself.I know this isn't part of
BulletPHP
but I was wondering if you had any thoughts on why this might not be working? I will probably ask theWhoops
folks too.The text was updated successfully, but these errors were encountered: