Error action short circuiting application module bootstrap code

64 views Asked by At

My error page never hits the following code during execution.

Understanding the DesignHandler is not important here but what is important is when an error occurs it routes correctly to the error page but never hits this piece of code.

namespace Application;

class Module
{
    public function onBootstrap(MvcEvent $e)
    {
        $events = $e->getApplication()->getEventManager();  
        $sharedEvents = $events->getSharedManager();
        $sharedEvents->attach(__NAMESPACE__, 'dispatch', function($e) { 
            $designHandler = Pluto::app()->getDesignHandler();
            $designHandler->pump($e);
        }, 20);
     }
}

OR ( I tried both onbootstrap and init)

namespace Application;

class Module
{
    public function init(\Zend\ModuleManager\ModuleManager $manager)
    {
        $events = $manager->getEventManager();  
        $sharedEvents = $events->getSharedManager();
        $sharedEvents->attach(__NAMESPACE__, 'dispatch', function($e) { 
            $designHandler = Pluto::app()->getDesignHandler();
            $designHandler->pump($e);
        }, 20);
     }
}

I have no clue as how to resolve this. I imagine that when an error hits it short circuits the route and this code never gets hit

UPDATE

I also tried this with both pieces of code and no success:

 $sharedEvents->attach(__NAMESPACE__, 'dispatch.error', function($e) {
        $designHandler = Pluto::app()->getDesignHandler();
        $designHandler->pump($e);
    }, 20);
0

There are 0 answers