/**
  * Interne Verarbeitung der Exception
  *
  * @param string $actionName
  * @param Exception $e
  * @param tx_rnbase_configurations $configurations
  *
  * @return string error message
  */
 public function handleException($actionName, Exception $e, tx_rnbase_configurations $configurations)
 {
     // wir prüfen erst mal, ob die exception gefangen werden soll
     $catch = $this->catchException($actionName, $e, $configurations);
     if ($catch !== NULL) {
         return $catch;
     }
     // wenn nicht senden wir ggf den header
     if ($this->send503HeaderOnException($configurations)) {
         header('HTTP/1.1 503 Service Unavailable');
     }
     // wir loggen nun den fehler
     tx_rnbase::load('tx_rnbase_util_Logger');
     if (tx_rnbase_util_Logger::isFatalEnabled()) {
         $extKey = $configurations->getExtensionKey();
         $extKey = $extKey ? $extKey : 'rn_base';
         tx_rnbase_util_Logger::fatal('Fatal error for action ' . $actionName, $extKey, array('Exception' => array('message' => $e->getMessage(), 'code' => $e->getCode(), 'file' => $e->getFile(), 'line' => $e->getLine(), 'trace' => $e->getTraceAsString()), '_GET' => $_GET, '_POST' => $_POST));
     }
     // wir senden eine fehlermail
     $addr = tx_rnbase_configurations::getExtensionCfgValue('rn_base', 'sendEmailOnException');
     if ($addr) {
         tx_rnbase_util_Misc::sendErrorMail($addr, $actionName, $e);
     }
     // Now message for FE
     $ret = $this->getErrorMessage($actionName, $e, $configurations);
     return $ret;
 }
    /**
     * sendet eine error mail für alle tasks die hängen geblieben
     * sind. außerdem werden diese tasks auf freezdeteced = exectime gesetzt
     * @param array $aPossiblyFrozenTasks
     * @return void
     */
    protected function handleFrozenTasks($aPossiblyFrozenTasks)
    {
        //Nachrichten für den error mail versand
        $aMessages = $aUids = array();
        foreach ($aPossiblyFrozenTasks as $aPossiblyFrozenTask) {
            $classname = tx_rnbase_util_TYPO3::isTYPO62OrHigher() ? get_class(unserialize($aPossiblyFrozenTask['serialized_task_object'])) : $aPossiblyFrozenTask['classname'];
            $aMessages[] = '"' . $classname . ' (Task-Uid: ' . $aPossiblyFrozenTask['uid'] . ')"';
            $aUids[] = $aPossiblyFrozenTask['uid'];
        }
        //wir bauen eine exception damit die error mail von rnbase gebaut werden kann
        $sMsg = '
			Die folgenden Scheduler Tasks hängen seit mindestens ' . tx_mklib_util_Scheduler::getFormattedTime($this->getOption('threshold')) . ' : ' . implode(', ', $aMessages);
        $oException = new Exception($sMsg, 0);
        tx_rnbase::load('tx_rnbase_util_Misc');
        //die Mail soll immer geschickt werden
        $aOptions = array('ignoremaillock' => true);
        tx_rnbase_util_Misc::sendErrorMail($this->getOption('receiver'), 'tx_mklib_scheduler_CheckRunningTasks', $oException, $aOptions);
        //bei allen hängen geblibenen tasks freezedetected setzen
        //damit erst nach der errinerungszeit wieder eine mail versendet wird
        $this->setFreezeDetected($aUids);
        return $sMsg;
    }
Пример #3
0
 /**
  * Send an exeption mail for all exceptions during the store log process
  *
  * @param \Exception $e
  *
  * @TODO: add recursive call check for exceptions (
  *     throw exception, only block at secnd exception.
  *     so the gelf logger can log the exception
  *     and only a recursion of logging will prevented.
  * )
  *
  * @return void
  */
 protected function handleExceptionDuringLogging(\Exception $e)
 {
     // try to send mail
     $addr = \tx_rnbase_configurations::getExtensionCfgValue('rn_base', 'sendEmailOnException');
     if ($addr) {
         \tx_rnbase_util_Misc::sendErrorMail($addr, 'Mklog\\DevlogLogger', $e);
     }
 }
 /**
  * sends a exception mail
  *
  * @param string $email
  * @param Exception $exception
  * @return void
  */
 protected function sendErrorMail($email, Exception $exception)
 {
     tx_rnbase::load('tx_rnbase_util_Misc');
     $options = array('ignoremaillock' => true);
     tx_rnbase_util_Misc::sendErrorMail($email, get_class($this), $exception, $options);
 }