Files
kupshop/bundles/KupShop/ContentBundle/View/Error500View.php
2025-08-02 16:30:27 +02:00

58 lines
1.2 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: ondra
* Date: 11.10.17
* Time: 8:00.
*/
namespace KupShop\ContentBundle\View;
use KupShop\KupShopBundle\Views\Traits\RequestTrait;
use KupShop\KupShopBundle\Views\View;
use Symfony\Component\HttpFoundation\Request;
class Error500View extends View
{
use RequestTrait;
protected $template = 'error500.tpl';
protected string $smartyFallback = 'blank';
protected \Throwable $exception;
protected ?string $sentryEventId;
public function getTemplateVariables()
{
return [
'view' => $this,
'exception' => $this->exception,
'event_id' => $this->sentryEventId,
];
}
public function getResponse(?Request $request = null)
{
$response = parent::getResponse($request);
$response->setStatusCode(500);
return $response;
}
public function setException(\Throwable $exception): Error500View
{
$this->exception = $exception;
return $this;
}
public function setSentryEventId(?string $sentryEventId): Error500View
{
$this->sentryEventId = $sentryEventId;
return $this;
}
}