Пример #1
0
 /**
  * Render an exception using Whoops.
  *
  * @param  \Exception $e
  * @return \Illuminate\Http\Response
  */
 protected function renderExceptionWithWhoops(Exception $e)
 {
     $whoops = new \Whoops\Run();
     $handler = new \Whoops\Handler\PrettyPageHandler();
     if ($e instanceof ValidationException) {
         $handler->addDataTable('Validation Errors', $e->validator->errors()->all());
     }
     $whoops->pushHandler($handler);
     return new \Illuminate\Http\Response($whoops->handleException($e), $e->getStatusCode(), $e->getHeaders());
 }
Пример #2
0
 public function onError(ErrorEvent $event)
 {
     if (php_sapi_name() == "cli") {
         return;
     }
     header('X-Error-Message: ' . $event->getException()->getMessage(), true, 500);
     $whoops = new \Whoops\Run();
     $request = $event->getContext()->getRequest();
     $handler = new \Whoops\Handler\PrettyPageHandler();
     $event->getContext()->getActionName();
     $prev = $event->getException()->getPrevious();
     $fwkTable = array('Application name' => $event->getApplication()->getName(), 'Action name' => $event->getContext()->getActionName(), 'Context state' => $event->getContext()->getState(), 'Context error' => $event->getContext()->getError());
     $parents = $this->getParentExceptionsMessage($event->getException());
     if (!is_array($parents)) {
         $parents = array();
     }
     foreach ($parents as $idx => $exp) {
         $fwkTable['Parent Exception #' . $idx] = $exp;
     }
     $handler->addDataTable('Fwk\\Core Informations', $fwkTable);
     $handler->addDataTable('Request Informations', array('URI' => $request->getUri(), 'Request URI' => $request->getRequestUri(), 'Path Info' => $request->getPathInfo(), 'Query String' => $request->getQueryString() ?: '<none>', 'HTTP Method' => $request->getMethod(), 'Script Name' => $request->getScriptName(), 'Base Path' => $request->getBasePath(), 'Base URL' => $request->getBaseUrl(), 'Scheme' => $request->getScheme(), 'Port' => $request->getPort(), 'Host' => $request->getHost()));
     $whoops->pushHandler($handler);
     $whoops->register();
 }
 public function __construct()
 {
     $CI =& get_instance();
     $_env = ENVIRONMENT;
     require_once __DIR__ . '/../../vendor/autoload.php';
     $whoops = new Whoops\Run();
     // Configure the PrettyPageHandler:
     $errorPage = new Whoops\Handler\PrettyPageHandler();
     $errorPage->setPageTitle("Oh No, It's broken!");
     // Set the page's title
     $errorPage->setEditor("sublime");
     // Set the editor used for the "Open" link
     $errorPage->addDataTable("Extra Info", array("route" => $CI->uri->uri_string()));
     $whoops->pushHandler($errorPage);
     if ($CI->input->is_ajax_request() == true) {
         $whoops->pushHandler(new Whoops\Handler\JsonResponseHandler());
     }
     // Debug true in env development
     if ($_env == 'development') {
         $whoops->register();
         $this->whoops = $whoops;
     }
 }
Пример #4
0
<?php

/**
 * Configura a exibição de erros no Slim Framework
 */
if (DEBUG) {
    $errorPage = new Whoops\Handler\PrettyPageHandler();
    $errorPage->setPageTitle("WebDevBr Erro!");
    $errorPage->setEditor("sublime");
    $errorPage->addDataTable("Documentação", array("Url" => "http://docs.slimframework.com/"));
    $whoops = new Whoops\Run();
    $whoops->pushHandler($errorPage);
    $whoops->register();
} else {
    echo '{message: error}';
}
Пример #5
0
        $runner = new League\BooBoo\Runner();
        $accept = $c['router']->getContainer()['request']->getHeader('Accept');
        $accept = join(' ', $accept);
        // If we accept html, show html, else show json
        if (strpos($accept, 'html') !== false) {
            $runner->pushFormatter(new League\BooBoo\Formatter\HtmlTableFormatter());
        } else {
            $runner->pushFormatter(new League\BooBoo\Formatter\JsonFormatter());
        }
        $runner->register();
    } else {
        if (class_exists('Whoops\\Run')) {
            $run = new Whoops\Run();
            $handler = new Whoops\Handler\PrettyPageHandler();
            $handler->setPageTitle('Parvula Error');
            $handler->addDataTable('Parvula', ['Version' => _VERSION_]);
            $run->pushHandler($handler);
            if (Whoops\Util\Misc::isAjaxRequest()) {
                $run->pushHandler(new Whoops\Handler\JsonResponseHandler());
            }
            $run->register();
            if (class_exists('Monolog\\Logger')) {
                // Be sure that Monolog is still register
                Monolog\ErrorHandler::register($c['loggerHandler']);
            }
            return $run;
        }
    }
};
// To parse serialized files in multiple formats
$app['fileParser'] = function () {