/** * Sets up the {@link Breeze\Errors\Errors::$_default_error} instance variable * for handling errors with no defined handler. * * @access public * @param Breeze\Application $application an instance of the base Breeze Framework class for passing into closures. * @return void */ public function __construct(Application $application) { $this->_application = $application; $this->_default_error = function (Application $application, \Exception $exception) use($application) { $body = sprintf("<h1>%s</h1>", $exception->getMessage()); if ($application->config('errors_backtrace')) { $body .= sprintf('<pre><code>%s</code></pre>', $exception->getTraceAsString()); } if ($application->layoutExists()) { echo $application->fetchLayout($body); } else { echo "<!DOCTYPE html><html><head><title>An error occurred</title></head><body>{$body}</body></html>"; } }; }