<?php
use Whoops\Run;
use Whoops\Handler\JsonResponseHandler as Handler;
$whoops = new Run();
// you should see the PrettyPageHandler. it's awesome!
// http://filp.github.io/whoops/screen.png
$whoops->pushHandler(new Handler());
$whoops->register();
// don't directly output on handleException
$whoops->writeToOutput(false);
$whoops->allowQuit(false);
$e = new Exception('Error: no budgies found');
$output = $whoops->handleException($e);
echo $output;