I am finding that when an Exception is raised at the top of my
preDispatch(), I get a generic PHP uncaught exception error.

When I throw one a little further along the way, I get my error
controller/error action as expected, but the layout is rendered three times.

When I throw an Exception in the course of a controller action, the error
handler does its thing as it should and the layout is rendered but once.

So -- I am doing something weird, or is this expected, and if so, what's the
solution -- any ideas?

Here's a sample from my authentication/Acl plugin:


function preDispatch(Zend_Controller_Request_Abstract $request ) {
        // throw new Exception('oops!'); // generic PHP uncaught exception
error is displayed
        $module = $request->getModuleName();

        if ( 'default' != $module)
        {
            if (! $this->auth->hasIdentity()) {
                $session = new Zend_Session_Namespace();
                $session->redirectTo = $_SERVER['REQUEST_URI'];

                $request->setModuleName('default')
                        ->setControllerName('users')
                        ->setActionName('login');
                return;
            }
            // throw new Exception('oops!');   // layout renders 3 times
            $this->checkAcl($request);
        }
    }

Gratefully,

           David

-- 
Demand health care for everyone:
http://mobilizeforhealthcare.org/

--
David Mintz
http://davidmintz.org/

Reply via email to