Return to Snippet

Revision: 30273
at August 11, 2010 05:14 by javierav


Initial Code
try
{
    // Attempt to execute the response
    $request->execute();
}
catch (Exception $e)
{
    if ( ! IN_PRODUCTION)
    {
        // Just re-throw the exception
        throw $e;
    }
    try
    {
        // Log the error
        Kohana::$log->add(Kohana::ERROR, Kohana::exception_text($e));

        // Create a 404 response
        $request->status = 404;
        $request->response = View::factory('template')
            ->set('title', '404')
            ->set('content', View::factory('errors/404'));
    }
    catch (Exception $e)
    {
         echo "Something terrible happened. We will look into it!";
         Kohana::$log->add(Kohana::ERROR, Kohana::exception_text($e));
    }
}

Initial URL
http://forum.kohanaframework.org/comments.php?DiscussionID=5016&page=1#Item_0

Initial Description


Initial Title
Capturar errores en producción

Initial Tags
error

Initial Language
PHP