You will need to perform incorrect error handling. We ourselves have contributed to Symfony’s own action. Be careful, although this action may also throw an exception, you should take this into account.
The following may be a good start. Add a listener for the event first, a good place would be ProjectConfiguration.class.php:
$this->dispatcher->connect('application.throw_exception', array('MyClass', 'handleException'));
Using an event handler may be sufficient for what you want to do with an exception, for example, if you just want to send a stack trace to the administrator. We wanted to move on to a custom action to display and process the feedback form. Our event handler looked something like this:
class MyClass {
public static function handleException(sfEvent $event) {
$moduleName = sfConfig::get('sf_error_500_module', 'error');
$actionName = sfConfig::get('sf_error_500_action', 'error500');
sfContext::getInstance()->getRequest()->addRequestParameters(array('exception' => $event->getSubject()));
$event->setReturnValue(true);
sfContext::getInstance()->getController()->forward($moduleName, $actionName);
}
}
Now you can configure the module and action to forward to the exception in settings.yml
all:
.actions:
error_500_module: error
error_500_action: error500
, , , . , . , $request- > getParameter ('exception')