/** * Call error handler * * This will invoke the custom or default error handler * and RETURN its output. * * @param \Exception|null $argument * @return string */ protected function callErrorHandler($argument = null) { ob_start(); $customErrorHandler = $this->router->error(); if (is_callable($customErrorHandler)) { call_user_func_array($customErrorHandler, array($argument)); } else { call_user_func_array(array($this, 'defaultError'), array($argument)); } return ob_get_clean(); }