Hi All :-)

How do you trap errors that may be the result of a custom query? For
example:

$results = $model->query($sql);

In my case, some of the custom sql queries creates such a large
dataset that the script exceeds the memory allocated to php.

I would like to catch these errors and present something a bit more
friendly to the user.

I've tried wrapping the code in a try/catch block as I would normally
do:

try {

$results = $model->query($sql);

}
catch (Exception $e) {

  // handle error here

}

but the error is still raised and the try/catch is ignored.

While trying out this approach I noticed that if I do:

try {

 echo 1/0; // generate a divide be zero error to test

}
catch (Exception $e) {

  // handle error here

}

The error message is still displayed! I'm guessing that CakePHP is
already trapping these errors, so ultimately my question is:

How do I stop Cake from trapping errors so I can use my own error
handler, and how do I re-enable Cake error handling after the bit of
code I want to check has finished?

Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to