This commit is contained in:
Graham Campbell
2014-09-27 11:05:51 +01:00
parent 92ade3cda1
commit 0346c26963
43 changed files with 410 additions and 422 deletions
+14 -10
View File
@@ -14,33 +14,36 @@
*/
namespace Whoops\Example;
use Whoops\Run;
use Whoops\Handler\PrettyPageHandler;
use Exception as BaseException;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Run;
require __DIR__ . '/../vendor/autoload.php';
class Exception extends BaseException {}
class Exception extends BaseException
{
}
$run = new Run;
$handler = new PrettyPageHandler;
$run = new Run();
$handler = new PrettyPageHandler();
// Add a custom table to the layout:
$handler->addDataTable('Ice-cream I like', array(
'Chocolate' => 'yes',
'Coffee & chocolate' => 'a lot',
'Strawberry & chocolate' => 'it\'s alright',
'Vanilla' => 'ew'
'Vanilla' => 'ew',
));
$run->pushHandler($handler);
// Example: tag all frames inside a function with their function name
$run->pushHandler(function($exception, $inspector, $run) {
$run->pushHandler(function ($exception, $inspector, $run) {
$inspector->getFrames()->map(function($frame) {
$inspector->getFrames()->map(function ($frame) {
if($function = $frame->getFunction()) {
if ($function = $frame->getFunction()) {
$frame->addComment("This frame is within function '$function'", 'cpt-obvious');
}
@@ -51,7 +54,8 @@ $run->pushHandler(function($exception, $inspector, $run) {
$run->register();
function fooBar() {
function fooBar()
{
throw new Exception("Something broke!");
}