1 | <?php |
||
19 | class HandleExceptionsMiddleware implements Middleware |
||
20 | { |
||
21 | /** |
||
22 | * @var LoggerInterface |
||
23 | */ |
||
24 | private $logger; |
||
25 | |||
26 | public function __construct(LoggerInterface $logger) |
||
30 | |||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | protected $keepSystemErrorMessage = false; |
||
35 | |||
36 | /** |
||
37 | * @param object|BaseCommand $command |
||
38 | * @param callable $next |
||
39 | * |
||
40 | * @return mixed |
||
41 | */ |
||
42 | public function execute($command, callable $next) |
||
56 | |||
57 | public function setKeepSystemErrorMessage(bool $keepSystemErrorMessage): void |
||
61 | |||
62 | private function handleDomainException(BaseCommand $command, DomainException $domainException) |
||
66 | |||
67 | private function handleArgumentException(BaseCommand $command, \InvalidArgumentException $exception) |
||
71 | |||
72 | private function handleUnclassifiedError(BaseCommand $command, \Exception $exception) |
||
76 | |||
77 | private function handleAuthenticationError(BaseCommand $command, NotAuthenticatedException $exception) |
||
81 | |||
82 | private function ensureExceptionCanBeKept(\Exception $exception): \Exception |
||
92 | } |
||
93 |