/** * @inherit */ public function handleError(\R3H6\Error404page\Domain\Model\Error $error) { if ($this->httpService->isOwnRequest()) { $this->getLogger()->debug("Throw exception 1475311053"); throw new \Exception("Error processing request", 1475311053); } if ($this->extensionConfiguration->is('enableErrorLog')) { $this->errorRepository->log($error); } $cacheIdentifier = $this->errorHandlerCache->calculateCacheIdentifier($error); $errorHandler = $this->errorHandlerCache->get($cacheIdentifier); if ($errorHandler === null) { foreach ($this->getErrorHandlers() as $errorHandler) { try { $this->getLogger()->debug('Try handle error with ' . get_class($errorHandler)); if ($errorHandler->handleError($error)) { $this->errorHandlerCache->set($cacheIdentifier, $errorHandler); break; } } catch (\Exception $exception) { $this->getLogger()->debug('Could not handle error in ' . get_class($errorHandler) . ': ' . $exception->getMessage()); } } } $this->getLogger()->debug('Get error handler output of ' . get_class($errorHandler)); return $errorHandler->getOutput($error); }
/** * @test */ public function handleErrorDoesNotLogErrorWhenConfigurationIsNotSet() { /** @var \R3H6\Error404page\Domain\Model\Error $errorFixture */ $errorFixture = new Error(); $this->mockGetErrorHandlers(); $this->errorRepositoryMock->expects($this->never())->method('log'); $this->subject->handleError($errorFixture); }
/** * Returns the date options * * @return array options for select */ public function getMinDateOptions() { $eldestError = $this->_errorRepository->findEldestError(); $options = array(); if ($eldestError !== null) { $minTime = strtotime(self::TIME_ONE_WEEK_AGO); if ($eldestError->getTimestamp() < $minTime) { $options[$minTime] = LocalizationUtility::translate('tx_error404page_domain_model_dto_errordemand.min_date.7', 'error404page'); } $minTime = strtotime(self::TIME_ONE_MONTH_AGO); if ($eldestError->getTimestamp() < $minTime) { $options[$minTime] = LocalizationUtility::translate('tx_error404page_domain_model_dto_errordemand.min_date.31', 'error404page'); } $minTime = strtotime(self::TIME_ONE_YEAR_AGO); if ($eldestError->getTimestamp() < $minTime) { $options[$minTime] = LocalizationUtility::translate('tx_error404page_domain_model_dto_errordemand.min_date.365', 'error404page'); } } $options[0] = LocalizationUtility::translate('tx_error404page_domain_model_dto_errordemand.min_date.0', 'error404page'); return $options; }
/** * action deleteAll * * @return void */ public function deleteAllAction() { $this->errorRepository->deleteAll(); $this->addFlashMessage('Truncated errors log.'); $this->redirect('dashboard'); }