Hi again,

i had the need to use the Exception handling of the ErrorHandler also
for my bootstrab code, not only for the dispatch process and the
controllers. So i have one place where all errors go.

At the moment i've used a dirty hack to make this work:

bootstrap.php:

try {

.. all bootstrap init code goes here ..


}
catch(Exception $e) {
  // create own response object
  require_once 'Zend/Controller/Response/Http.php';
  $my_response = new Zend_Controller_Response_Http();
  $my_response->setException($e);
  Zend_Controller_Front::getInstance()
                         ->setResponse($this->_response);
}

Then i pass the response object to the dispatch method
($front->dispatch(null, $my_response).

To make this work i have to add one method to the ErrorHandler:
public function preDispatch()
{
  $this->postDispatch();
}


I think this is a use case that should be solved within the framework,
so the coder can use the exception handling of the framework also for
the bootstrap (db init for example) file.

Is there a more elegand solution to this use case ?


best regards,
Truppe Steven



Reply via email to