Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Undefined class constant 'EXCEPTION_HANDLER_NOT_FOUND'

use Phalcon\Events\Event;
use Phalcon\Dispatcher;
use Phalcon\Mvc\Dispatcher\Exception as DispatcherException;

            function($event, $dispatcher, $exception)
                switch ($exception->getCode()) {
                    case MvcDispatcher::EXCEPTION_HANDLER_NOT_FOUND:
                    case MvcDispatcher::EXCEPTION_ACTION_NOT_FOUND:
                                'namespace' => 'Controllers',
                                'controller' => 'No',
                                'action'     => 'index',
                        return false;

Get error Undefined class constant 'EXCEPTION_HANDLER_NOT_FOUND'


If none of the routes, specified in the router, match, you can define a 404 controller/action by using the notFound method.


        'controller' => 'index',
        'action'     => 'fourOhFour',

NOTE: This will only work if the router was created without default routes: $router = Phalcon\Mvc\Router(false);