/**
  * @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);
 }
 /**
  * @inherit
  */
 public function handleError(\R3H6\Error404page\Domain\Model\Error $error)
 {
     $errorPage = $this->pageRepository->find404PageForError($error);
     if ($errorPage !== null) {
         $this->output = $this->httpService->readUrl($errorPage->getUrl());
         if ($this->output) {
             $this->cacheTags[] = 'pageId_' . $errorPage->getUid();
             return true;
         }
     }
     return false;
 }
 /**
  * @test
  * @expectedException Exception
  */
 public function handleErrorThrowsExceptionForOwnRequests()
 {
     /** @var \R3H6\Error404page\Domain\Model\Error $errorFixture */
     $errorFixture = new Error();
     $this->httpServiceMock->expects($this->once())->method('isOwnRequest')->will($this->returnValue(true));
     $this->subject->handleError($errorFixture);
 }
 /**
  * @test
  */
 public function handleErrorReturnsTrueIfPageIsFound()
 {
     $expected = 'Error 404';
     /** @var \R3H6\Error404page\Domain\Model\Error $errorFixture */
     $errorFixture = new Error();
     /** @var \R3H6\Error404page\Domain\Model\Error $pageMock */
     $pageMock = $this->getPageMock(404, 'test');
     $this->pageRepositoryMock->expects($this->once())->method('find404PageForError')->with($errorFixture)->will($this->returnValue($pageMock));
     $this->httpServiceMock->expects($this->once())->method('readUrl')->with($this->equalTo('test'))->will($this->returnValue($expected));
     $this->assertTrue($this->subject->handleError($errorFixture));
     $this->assertSame($expected, $this->subject->getCachingData());
     $this->assertContains('pageId_404', $this->subject->getCacheTags());
 }
 /**
  * @inherit
  */
 public function getOutput(\R3H6\Error404page\Domain\Model\Error $error)
 {
     $this->httpService->redirect($this->redirect);
 }