zeuxisoo / php-slim-whoops

PHP whoops error on slim framework
131 stars 10 forks source link

How I can enable/disable the JsonResponseHandler ? #8

Closed borgogelli closed 9 years ago

borgogelli commented 9 years ago

How I can enable/disable the JsonResponseHandler ?

Thank you in advance

Greeting from Italy

Andrea

zeuxisoo commented 9 years ago

Currently, This option is not supported. Why do you need this option?

borgogelli commented 9 years ago

I can't understand the following code...

class WhoopsMiddleware extends Middleware { .... $app->container->singleton('whoopsJsonResponseHandler', function() { $handler = new JsonResponseHandler(); $handler->onlyForAjaxRequests(true); return $handler; }); ....

is the JsonResponseHandler always available ?

we like to use two handlers like in the following code:

$whoops->pushHandler(new Whoops\Handler\PrettyPageHandler); $whoops->pushHandler(new Whoops\Handler\JsonResponseHandler)

zeuxisoo commented 9 years ago

By default, The JsonResponseHandler is always available when you added this middleware.

If the user request is AJAX and got exception. It will handled by JsonResponseHandler. If the user request is NOT AJAX and got exception. It will NOT handled by JsonResponseHandler.

Also, the PrettyPageHandler is the default handler.