Pass Inspector into data table callbacks

This commit is contained in:
Andrij
2016-03-21 12:46:16 +02:00
parent 1de56025c4
commit d0c1cba8eb
3 changed files with 35 additions and 5 deletions
+11
View File
@@ -36,6 +36,17 @@ $handler->addDataTable('Ice-cream I like', array(
'Vanilla' => 'ew',
));
$handler->addDataTableCallback('Details', function(\Whoops\Exception\Inspector $inspector) {
$data = array();
$exception = $inspector->getException();
if ($exception instanceof SomeSpecificException) {
$data['Important exception data'] = $exception->getSomeSpecificData();
}
$data['Exception class'] = get_class($exception);
$data['Exception code'] = $exception->getCode();
return $data;
});
$run->pushHandler($handler);
// Example: tag all frames inside a function with their function name