Hello,

I have read about the ErrorController that comes standard with the
framework. It seems to only handle certain errors pertaining to missing MVC
components--that's fine, I can use that. However, for my purposes I think I
need a better understanding of URL rewriting and how the framework works in
general.

Anyway, here is what I have done in terms of error handling. It's pretty
simplistic.

My application entry point is wrapped in a try-catch. When an exception pops
anywhere in the application, I run a couple of procedures that then send an
email and log the message, etc.

/* Wrap the entire application in an error handler*/
try
{
        $application->bootstrap()
                                ->run();
}
catch (Exception $e) 
{
        require_once 'ErrorHandler.php';
        HandleException($e);
}

What I really want to do is just pop a jquery dialog box on the page that
pops the error (or the previous page if there is something like a 404
error). In order to do this I am trying the following:

catch (Exception $e) 
{
        //require_once 'ErrorHandler.php';
        //HandleException($e);
        
        /*
                Get the current layout and relocate to it,
                passing a flag to display the error dialog
        */

$currentLayout=$application->getBootstrap()->getResource('layout')->getLayoutPath();
        header('Location: ' . $currentLayout . '?action=error');
}

The problem is, I don't understand enough about what is going on behind the
scenes. $currentLayout points to the layouts directory. The querystring is
lost as "http://localhost/TAW/application/layouts?action=error"; then points
back to a valid page.

At the end of the day, it doesn't make sense to point back to a "valid"
page...I would probably point to an "error" page that utilizes a defined
layout. But in any case, I still need to maintain that querystring.

Does anyone have any thoughts about this entire process? Some best
practices? Or more specifically, how to resolve the issue I am having
concerning the querystring?

Much appreciated!

Jeremy
-- 
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/Error-handling-in-Zend-tp3089950p3089950.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to