[symfony-users] - Symfony 1.4.8 - Problems with a redirect() inside of a try...catch construct in action code

2011-01-10 Thread Gabriel Comeau
Hello all, I'm having a problem using a redirect inside of my action code. The problem is that the redirect occurs inside of a try block. Before it happens, there is a method call to an object from my model. If this object is not in the right state when the method is called, it throws an

Re: [symfony-users] - Symfony 1.4.8 - Problems with a redirect() inside of a try...catch construct in action code

2011-01-10 Thread Stéphane
Hi, Yes it is a good idea to create your own exception class ! A little link, worth reading, about exceptions http://ralphschindler.com/2010/09/15/exception-best-practices-in-php-5-3 http://ralphschindler.com/2010/09/15/exception-best-practices-in-php-5-3:) No there's no symfony way about

Re: [symfony-users] - Symfony 1.4.8 - Problems with a redirect() inside of a try...catch construct in action code

2011-01-10 Thread Gábor Fási
Creating your own exception class is the best way, but I'd still like to add this alternative: using multiple catch bocks after a try: try { //your stuff } catch (sfStopException $e) { throw $e; //rethrowing it, nothing else to do } catch (Exception $e) { //handle error } On Mon, Jan 10,

Re: [symfony-users] - Symfony 1.4.8 - Problems with a redirect() inside of a try...catch construct in action code

2011-01-10 Thread Gabriel Comeau
Hi guys, Thanks for your responses! I've decided I'll create some custom exceptions for my project; it does seem like the cleanest solution. I am however curious as to why exactly I am seeing the behavior I am seeing - maybe someone can shed some light on this. The redirect('thanks'); call

Re: [symfony-users] - Symfony 1.4.8 - Problems with a redirect() inside of a try...catch construct in action code

2011-01-10 Thread Stéphane
Your code catch the exception because you ask it to do so by coding a catch(Exception - here, Exception is the master class of all Exceptions ! sfStopException inherits from this class, so your catch will catch it as expected :) Now if you create a myException extends sfException, and you catch

Re: [symfony-users] - Symfony 1.4.8 - Problems with a redirect() inside of a try...catch construct in action code

2011-01-10 Thread Gabriel Comeau
Right, but why does it only execute the first part of the catch block and not the redirect inside of it? -Gabe -- 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

Re: [symfony-users] - Symfony 1.4.8 - Problems with a redirect() inside of a try...catch construct in action code

2011-01-10 Thread Stéphane
The framework should send a response with http header Location:. It doesn't ? Regards, Before Printing, Think about Your Environmental Responsibility! Avant d'Imprimer, Pensez à Votre Responsabilitée Environnementale! On Mon, Jan 10, 2011 at 9:43 PM, Gabriel Comeau