/** * Handles all exceptions thrown inside the application */ protected function callActionMethod() { try { parent::callActionMethod(); } catch (Exception $exception) { if ($exception instanceof \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException) { throw $exception; } header('HTTP/1.1 500 Internal Server Error', true, 500); $this->response->setContent($exception->getCode()); if ($exception instanceof Tx_PtExtbase_Exception_LoggerException) { $this->logger->log($exception->getLogLevel(), sprintf('%s (%s)', $exception->getMessage(), $exception->getCode()), get_class($this)); } else { $this->logger->error(sprintf('%s (%s)', $exception->getMessage(), $exception->getCode()), get_class($this)); } $this->objectManager->get('TYPO3\\CMS\\Extbase\\Persistence\\Generic\\PersistenceManager')->persistAll(); $this->cleanUpAtException($exception); return $exception->getCode(); } }