Skip to content

Commit

Permalink
clean up the error tutorial (refs #3769)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeelot committed Jun 6, 2012
1 parent 3120e8b commit a73ea67
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions guide/kohana/tutorials/error-pages.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Our custom exception handler is self explanatory.


public static function handler(Exception $e) public static function handler(Exception $e)
{ {
if (Kohana::DEVELOPMENT === Kohana::$environment) if (Kohana::$environment === Kohana::DEVELOPMENT)
{ {
parent::handler($e); parent::handler($e);
} }
Expand All @@ -26,22 +26,22 @@ Our custom exception handler is self explanatory.
{ {
Kohana::$log->add(Log::ERROR, parent::text($e)); Kohana::$log->add(Log::ERROR, parent::text($e));


$attributes = array $params = array
( (
'action' => 500, 'action' => 500,
'message' => rawurlencode($e->getMessage()) 'message' => rawurlencode($e->getMessage())
); );


if ($e instanceof HTTP_Exception) if ($e instanceof HTTP_Exception)
{ {
$attributes['action'] = $e->getCode(); $params['action'] = $e->getCode();
} }


// Error sub-request. // Error sub-request.
echo Request::factory(Route::get('error')->uri($attributes)) echo Request::factory(Route::get('error')->uri($params))
->execute() ->execute()
->send_headers() ->send_headers()
->body(); ->body();
} }
catch (Exception $e) catch (Exception $e)
{ {
Expand Down Expand Up @@ -92,10 +92,10 @@ would display an error 500 page.
{ {
parent::before(); parent::before();


$this->template->page = URL::site(rawurldecode(Request::$initial->uri())); $this->template->page = URL::site(rawurldecode(Request::initial()->uri()));


// Internal request only! // Internal request only!
if (Request::$initial !== Request::$current) if ( ! Request::current()->is_initial())
{ {
if ($message = rawurldecode($this->request->param('message'))) if ($message = rawurldecode($this->request->param('message')))
{ {
Expand Down

0 comments on commit a73ea67

Please sign in to comment.