Hi guys, i'm using MVC with multi modules with the following tree.

  • app
    • config
    • controllers
    • views
    • layouts
    • logs
    • library
  • modules
    • frontend
    • backend

Dispatcher

I use a dispatcher inside of config folder

use Phalcon\Mvc\Dispatcher as PhDispatcher;
/**
 * Setting up Page 404
 * https://stackoverflow.com/questions/14071261/how-to-setup-a-404-page-in-phalcon
 */
$di->set('dispatcher',function() use ($di) {

       $evManager = $di->getShared('eventsManager');

       $evManager->attach(
           "dispatch:beforeException",
           function($event, $dispatcher, $exception)
           {
               switch ($exception->getCode()) {
                   case PhDispatcher::EXCEPTION_HANDLER_NOT_FOUND:
                   case PhDispatcher::EXCEPTION_ACTION_NOT_FOUND:
                       $dispatcher->forward(
                           array(
                               'controller' => 'Error',
                               'action'     => 'e404',
                           )
                       );
                       return false;
               }
               $dispatcher->setParam('error', $exception);
           }
       );

       $dispatcher = new PhDispatcher();
       $dispatcher->setEventsManager($evManager);
       return $dispatcher;
   },
   true
 );

I want to send exceptions for controller Error!

Like in the index.php

} catch (Phalcon\Exception $e) {
echo $e->getMessage();
/*echo $e->getLine();
echo $e->getFile();
echo $e->getTraceAsString();*/

I want to this: https://staging.coopunity.com/asdasd

If someone could help me and give me some "lights"! Thanks!