public static function invoke($app_class, $app_root_dir, $env, Handler $handler = null) { $app = new $app_class($app_root_dir, $env); $dispatcher = new static($app); $dispatcher->boot(); if ($app->isDebug()) { if (is_null($handler)) { $handler = new \Whoops\Handler\PrettyPageHandler(); } $whoops = new \Whoops\Run(); $whoops->pushHandler($handler); $whoops->register(); } try { $response = $dispatcher->handleRequest(); } catch (\Exception $e) { if ($app->isDebug()) { throw $e; } $response = $dispatcher->handleError($e); } }
public static function invoke($app_class, $app_root_dir, $env) { $app = new $app_class($app_root_dir, $env); $dispatcher = new static($app); $dispatcher->boot(); try { $response = $dispatcher->handleRequest(); } catch (\Exception $e) { // Please handle errors occurred on executing Dispatcher::handleError with your web server. // Dietcube doesn't care these errors. $response = $dispatcher->handleError($e); } }