On 08.07.2007, at 04:38, Steve Lianoglou wrote:

>
> Hi Pierre,
>
>> So, what if there can be thrown 6 or 7 different exception in a try-
>> block and you don't want to handle all the same, but there's a  
>> forward
>> with an sfStopException. Tell me how to implement that without typing
>> 6-7 catch-blocks.
>
> One option is to maybe have finer-grained try/catch blocks that could
> allow for you to move the ``forward`` call outside of the try catch
> block so you can avoid this problem all together.
>
> If for some reason you can't do that, if you explicitly catch the
> ``sfStopException`` at the beginning of your try catch block, you can
> then rethrow it and it'll skip your general/catch-all ``catch
> (Exception $e)`` clause (which may immediately follow) and fire off
> the forward.
>
> something like this (sorry if the code comes out malformed):
>
> try {
>     // some
>     // error
>     // prone
>     // code
>     // here
>     // ...
>     $this->forward('module', 'action');
> } catch (sfStopException $e) {
>     throw $e;
> } catch (Exception $e) {
>     // enter your generic exception handling stuff here
> }
>
> That should allow you to pull off the "forward on success" behavior
> you're after with the addition of only 1 more catch clause.
>
> Does that do the trick?

well it would work of course .. but it illustrates the entire  
nastyness of the approach.

regards,
Lukas


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

Reply via email to