public function processException($e)
{
if (!$e instanceof BadRequestException && $this->httpResponse instanceof Nette\Http\Response) {
$this->httpResponse->warnOnBuffer = FALSE;
}
if (!$this->httpResponse->isSent()) {
$this->httpResponse->setCode($e instanceof BadRequestException ? $e->getCode() ?: 404 : 500);
}
$args = ['exception' => $e, 'request' => end($this->requests) ?: NULL];
if ($this->presenter instanceof UI\Presenter) {
try {
$this->presenter->forward(":{$this->errorPresenter}:", $args);
} catch (AbortException $foo) {
$this->processRequest($this->presenter->getLastCreatedRequest());
}
} else {
$this->processRequest(new Request($this->errorPresenter, Request::FORWARD, $args));
}
}