public static function registerErrorHandler() { // only show errors in dev environment if (static::$Config['environment'] == 'dev') { static::$whoops = new \Whoops\Run(); $Handler = new \Whoops\Handler\PrettyPageHandler(); $Handler->setPageTitle("Divergence Error"); static::$whoops->pushHandler($Handler); static::$whoops->register(); } else { error_reporting(0); } }
/** * Render an exception using Whoops. * * @param \Exception $e * @return \Illuminate\Http\Response */ protected function renderExceptionWithWhoops(Exception $e) { $whoops = new \Whoops\Run(); $ppHandler = new \Whoops\Handler\PrettyPageHandler(); $ppHandler->setPageTitle('Crap!'); $ppHandler->setResourcesPath(public_path()); $ppHandler->addCustomCss('/css/whoops.css'); // $ppHandler->addDataTable('Dashboard Details', [ // 'User ID' => Auth::user()->id // ]); $ppHandler->setEditor('sublime'); $whoops->pushHandler($ppHandler); return new \Illuminate\Http\Response($whoops->handleException($e), $e->getStatusCode(), $e->getHeaders()); }
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; } }
public static function ini($root = "") { require $root . "../core/Associates/Whoops/vendor/autoload.php"; // if (Config::get('loggin.debug')) { $whoops = new \Whoops\Run(); $errorPage = new \Whoops\Handler\PrettyPageHandler(); // $errorPage->setPageTitle(Config::get('loggin.msg')); // Set the page's title $errorPage->setEditor("sublime"); // $whoops->pushHandler($errorPage); $whoops->register(); } else { $whoops = new \Whoops\Run(); $errorPage = new \Whoops\Handler\PlainTextHandler(); $errorPage->msg = Config::get('loggin.msg'); $errorPage->bg_color = Config::get('loggin.bg'); $errorPage->handle(); $whoops->pushHandler($errorPage); $whoops->register(); } }
use Composer\Autoload\ClassLoader; use Illuminate\Cache\CacheManager; use Illuminate\Cache\MemcachedConnector; use Themosis\Configuration\Constant; use Themosis\Configuration\Images; use Themosis\Configuration\Menu; use Themosis\Configuration\Sidebar; use Themosis\Configuration\Support; use Themosis\Configuration\Template; use Themosis\Core\AdminLoader; use Themosis\Core\WidgetLoader; use Themosis\Facades\Config; $run = new \Whoops\Run(); $handler = new \Whoops\Handler\PrettyPageHandler(); // Set the title of the error page: $handler->setPageTitle("Whoops! There was a problem."); $run->pushHandler($handler); // Add a special handler to deal with AJAX requests with an // equally-informative JSON response. Since this handler is // first in the stack, it will be executed before the error // page handler, and will have a chance to decide if anything // needs to be done. if (\Whoops\Util\Misc::isAjaxRequest()) { $run->pushHandler(new \Whoops\Handler\JsonResponseHandler()); } // Register the handler with PHP, and you're set! $run->register(); /*----------------------------------------------------*/ // Set theme's configurations. /*----------------------------------------------------*/ // Load the theme configuration files.
<?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}'; }
public static function renderPretty(\Exception $e, \Phalcon\DIInterface $di) { $response = $di->get('response'); $response->setStatusCode(500, "Internal Server Error"); // Register error-handler. $run = new \Whoops\Run(); $handler = new \Whoops\Handler\PrettyPageHandler(); $handler->setPageTitle('An error occurred!'); $run->pushHandler($handler); $run->handleException($e); $response->send(); return; }
if (version_compare(phpversion(), '7.0.0', '<') && class_exists('League\\BooBoo\\Runner')) { $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