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