There's no cheap way of catching a exception alread catched.

I'd suggest you looked into changing you catch block. Let the external
components deal with the exception.

While you don't have you code ready to deal with the exception, a mid-term
fix could be throwing another Exception from catch.

try {
        $result = $dbconn->query("SELECT * FROM TABLE");
} catch (Exception $e) {
        throw new My_Db_Exception;
}

In your exception constructor deal with the exception as you are thinking
of.

Will that work for you?


Mauricio Cuenca wrote:
> 
> Hello Marcelo,
> 
> It's basically something like this:
> 
> try {
>         $result = $dbconn->query("SELECT * FROM TABLE");
> } catch (Exception $e) {
>         echo "Something is wrong...";
>         exit();
> }
> 
> I could modify the catch part and do some redirection or something
> similar, but the code has many SQL calls like this. I don't want to change
> each one manually.
> 
> 
> 
> Marcello Duarte wrote:
>> 
>> What code is in your catch statement?
>> 
>> 
>> Mauricio Cuenca wrote:
>>> 
>>> Hello,
>>> 
>>> I have an application that started small and now its big. The problem is
>>> that each database transaction has a try/catch statement.
>>> 
>>> Now I want to capture all those exceptions and send them to the error
>>> controller to display friendly error messages to users in the production
>>> environment.
>>> 
>>> Is there a way to force the Error Controller to catch this already
>>> catched exceptions without modifying each sql try/catch block in the
>>> code?
>>> 
>>> Thanks!
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Catching-catched-exceptions-tp19874696p19876265.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to