|
|
@ -25,11 +25,12 @@ class ErrorAction extends Action |
|
|
|
|
|
|
|
protected function execute() |
|
|
|
{ |
|
|
|
$this->template = 500; |
|
|
|
if ($this->exception instanceof Error404Exception) { |
|
|
|
$this->template = 404; |
|
|
|
} elseif ($this->exception instanceof ErrorHTTPException) { |
|
|
|
$this->template = 'HTTP'; |
|
|
|
} else { |
|
|
|
$this->template = 500; |
|
|
|
} |
|
|
|
$this->logError(); |
|
|
|
$this->sendHTTPCode(); |
|
|
@ -50,19 +51,16 @@ class ErrorAction extends Action |
|
|
|
|
|
|
|
protected function sendHttpCode() |
|
|
|
{ |
|
|
|
switch ($this->template) { |
|
|
|
case 404: |
|
|
|
case 'HTTP': |
|
|
|
if ($this->exception instanceof ErrorHTTPException) { |
|
|
|
header($this->exception->getHTTPHeader()); |
|
|
|
break; |
|
|
|
default: |
|
|
|
} else { |
|
|
|
header('HTTP/1.0 500 Internal Server Error'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected function logError() |
|
|
|
{ |
|
|
|
if ($this->template == 500) { |
|
|
|
if (!$this->exception instanceof Error404Exception) { |
|
|
|
ErrorHandler::logError($this->exception); |
|
|
|
} |
|
|
|
} |
|
|
|