1 <?php
2
3 namespace Objednavky;
4
5 use Nette,
6 App\Model,
7 Tracy\Debugger;
8
9
10 11 12
13 class ErrorPresenter extends BasePresenter
14 {
15
16 17 18 19
20 public function renderDefault($exception)
21 {
22 if ($exception instanceof Nette\Application\BadRequestException) {
23 $code = $exception->getCode();
24
25 $this->setView(in_array($code, array(403, 404, 405, 410, 500)) ? $code : '4xx');
26
27 Debugger::log("HTTP code $code: {$exception->getMessage()} in {$exception->getFile()}:{$exception->getLine()}", 'access');
28
29 } else {
30 $this->setView('500');
31 Debugger::log($exception, Debugger::EXCEPTION);
32 }
33
34 if ($this->isAjax()) {
35 $this->payload->error = TRUE;
36 $this->terminate();
37 }
38 }
39
40 }
41