<?php
use Phalcon\Events\Event;
use Phalcon\Dispatcher;
use Phalcon\Mvc\Dispatcher\Exception as DispatcherException;
$evManager->attach(
'dispatch:beforeException',
function($event, $dispatcher, $exception)
{
switch ($exception->getCode()) {
case MvcDispatcher::EXCEPTION_HANDLER_NOT_FOUND:
case MvcDispatcher::EXCEPTION_ACTION_NOT_FOUND:
$MvcDispatcher->forward(
array(
'namespace' => 'Controllers',
'controller' => 'No',
'action' => 'index',
)
);
return false;
}
}
);
Get error Undefined class constant 'EXCEPTION_HANDLER_NOT_FOUND'