Aerys\Server::tryFilterErrorResponse PHP Method

tryFilterErrorResponse() private method

When an uncaught exception is thrown by a filter we enable the $ireq->filterErrorFlag and add the offending filter's key to $ireq->badFilterKeys. Each time we initialize a response the bad filters are removed from the chain in an effort to invoke all possible filters. To handle the scenario where multiple filters error we need to continue looping until $ireq->filterErrorFlag no longer reports as true.
private tryFilterErrorResponse ( Throwable $error, InternalRequest $ireq, array $filters )
$error Throwable
$ireq InternalRequest
$filters array
    private function tryFilterErrorResponse(\Throwable $error, InternalRequest $ireq, array $filters)
    {
        while ($ireq->filterErrorFlag) {
            try {
                $ireq->filterErrorFlag = false;
                $response = $this->initializeResponse($ireq, $filters);
                $this->tryErrorResponse($error, $ireq, $response, $filters);
            } catch (ClientException $error) {
                return;
            } catch (\Throwable $error) {
                $this->logger->error($error);
                $this->close($ireq->client);
            }
        }
    }