We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Useless error messages

I often see useless errors like "A dependency injection object is required to access the 'response' service", but where it throws? How can I locate the incorrect code?



98.9k

In your public/index.php, at the end of the file, you'll see a try/catch block, you can print the backtrace there to see where the exception is generated:

try {

    //...

} catch (Exception $e) {
    echo $e->getMessage(), '<br>';
    echo $e->getTraceAsString(), '<br>';
}

Thanks :)