Well, thanks, but that doesn't help!

Here is what I'm trying to achieve:

I want the info about errors of type WARNING and NOTICE to be sent to my 
mail when it happen in production mode. (Since this two error levels are not 
critical but I need to know when it happens).

*Here is the code I've written for this:* https://gist.github.com/1027184

How it works:
1. Error is triggered
2. Custom ErrorHandler receives the error event
3. Custom ErrorHandler asks container to give it the mailer and send email. 
In this step I need to receive a request object from container.
4. Mailer should send email.

To achieve this I extended the 
default Symfony\Component\HttpKernel\Debug\ErrorHandler and added kernel 
adding method so that later I can request a container out of it.

Now the default behavior of ErrorHandler will throw an Exception if needed 
after it filters out the error level and if it didn't - the custom code will 
work sending an email and letting the whole script to work further.

But if I let an error occur *inside the controller* I got those 2 Exceptions 
I mentioned earlier.

And this seems strange for me as the request should be already created and 
injected into service container.
*You cannot create a service ("request") of an inactive scope ("request").*
Here is the Stack Trace:
at * appDevDebugProjectContainer ->getRequestService * ()  
at * Container ->get * ('request')  
at * Mailer ->sendError * ('8', 'Use of undefined constant tttt - assumed 
'tttt'', '.../FrontendBundle/Controller/HomeController.php', '40', *array*
())  
at * ErrorHandler ->handle * ('8', 'Use of undefined constant tttt - assumed 
'tttt'', '.../FrontendBundle/Controller/HomeController.php', '40', *array*
()) 
at * HomeController ->indexAction * ()  
at * call_user_func_array * (*array*(*object*(HomeController), 
'indexAction'), *array*())  
at * HttpKernel ->handleRaw * (*object*(Request), '1')  
at * HttpKernel ->handle * (*object*(Request), '1', *true*)  
at * HttpKernel ->handle * (*object*(Request), '1', *true*)
at * Kernel ->handle * (*object*(Request)) 
The stack trace sais to me that the error was triggered after the handle 
method was invoked.
What am I doing wrong?

Thanks!

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to