/** * This is out execption handler * @param Exception $exception */ function toratan_exception_handler($exception) { $mp = new \zinux\kernel\utilities\pipe("__ERRORS__"); try { $mp->write($exception); } catch (\Exception $e) { unset($e); modules\defaultModule\controllers\errorController::$__EXTERN_ERROR = $exception; } # we need to use api because httpRequest will contain error(/error will set error header) # cannot user `header()` we because of the URI change!! we want the error URI remain same. @\zinux\kernel\application\api::call("/error"); exit; }
public function Initiate() { parent::Initiate(); $this->layout->SetLayout("error"); if (!self::$__EXTERN_ERROR) { $mp = new \zinux\kernel\utilities\pipe("__ERRORS__"); if (!$mp->hasFlow() && strtolower($this->request->action->name) === "index") { header("location: /"); exit; } # empty the pipe and only keep the last error up while ($mp->hasFlow()) { $this->view->error = $mp->read(); } } else { $this->view->error = self::$__EXTERN_ERROR; self::$__EXTERN_ERROR = NULL; } $this->layout->AddTitle("iDisqus"); }