/** * Handle if a exception was thrown during execution of show or initialization of the class. * * @internal * * @param \Exception $exception * @return AbstractView|void */ public static function handleException(\Exception $exception) { if ($exception instanceof \FeM\sPof\exception\InvalidParameterException) { foreach ($exception->getParameters() as $parameter) { Session::addErrorMsg($parameter['name'] . ' - ' . $parameter['description']); } } Logger::getInstance()->exception($exception); return null; }
/** * Gather error info from exception and add as message. * * @param \Exception $exception * * @throws \Exception */ public function exception(\Exception $exception) { Session::addErrorMsg($exception->getMessage()); $this->debugBar['exceptions']->addException($exception); }
/** * Mark a request as error and log the message, go on with the associated view. This function is recoverable, if * you want to stop the further execution you have to throw an exception instead, which also be logged. * * @api * * @param string $message * @param array $param (optional) */ protected final function error($message, $param = null) { if ($this->isJSON) { $this->sendJson(false, $message); } if ($param === null) { Session::addErrorMsg($message); } else { Session::addErrorMsg($message, $param); } Logger::getInstance()->info('AbstractController->error(): ' . $message . (!empty($param) ? 'param: ' . var_export($param, true) : '')); }