Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
throw new HttpNotFoundException error
  • In my code i have such string:
    throw new HttpNotFoundException;

    And instead of showing 404 page it throw a standart error page with backtrace, but without any error message. Why so?

    Error!

    Fuel\Core\HttpNotFoundException [ Error ]:

    APPPATH/classes/controller/admin.php @ line 218

     throw new HttpNotFoundException;

    Backtrace
    1. COREPATH/classes/controller.php @ line 66
    2. COREPATH/classes/request.php @ line 428
    3. DOCROOT/index.php @ line 49
  • 404 processing happens in your index.php, by catching the exception and forging a new request for your _404_ route.

    Did you alter your index.php, or using one from an old version of Fuel that you forgot to upgrade?
  • Harro Verton, no i didn't alter it. I checked that all works fine on the localhost, and error occurs only on production server. May be it related with some server settings?
  • The standard index.php contains:

    // Generate the request, execute it and send the output.
    try
    {
        $response = Request::forge()->execute()->response();
    }
    catch (HttpNotFoundException $e)
    {
        // ...
    }

    If that code block is there, it can also be that your _404_ route is missing from your routes.php config file. If that is the case, index.php will rethrow the exeception as unhandled.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion