Added middleware that mitigates big error traces being logged for those not using mercure

This commit is contained in:
Alejandro Celaya
2022-02-20 10:36:54 +01:00
parent 5affe64b61
commit 6983f9b2bf
5 changed files with 47 additions and 11 deletions

View File

@@ -7,7 +7,6 @@ namespace Shlinkio\Shlink\Rest\Exception;
use Fig\Http\Message\StatusCodeInterface;
use Mezzio\ProblemDetails\Exception\CommonProblemDetailsExceptionTrait;
use Mezzio\ProblemDetails\Exception\ProblemDetailsExceptionInterface;
use Throwable;
class MercureException extends RuntimeException implements ProblemDetailsExceptionInterface
{
@@ -16,9 +15,9 @@ class MercureException extends RuntimeException implements ProblemDetailsExcepti
private const TITLE = 'Mercure integration not configured';
private const TYPE = 'MERCURE_NOT_CONFIGURED';
public static function mercureNotConfigured(?Throwable $prev = null): self
public static function mercureNotConfigured(): self
{
$e = new self('This Shlink instance is not integrated with a mercure hub.', 1, $prev);
$e = new self('This Shlink instance is not integrated with a mercure hub.');
$e->detail = $e->getMessage();
$e->title = self::TITLE;