Whenever a database query fails (as in syntax error, missing table, no connection etc) I would like the user to be redirected to an error page, rather than execution of the request just continuing with incomplete data which could cause more errors.
How come this isn't the default behaviour of Cake? Anyway, it seems the way to do this is to implement the onError function in app_model.php - is this correct? Or is there some other way of catching this? First of all: I have tried this, but it doesn't get called when I get a database error of any kind... what am I missing? class AppModel extends Model { function onError() { $this->log($some_error_info); $this->redirect($some_error_url); } } Also: when exactly does it get called? Is this fully implemented in Cake 1.1? I'm not in a position where I can upgrade to 1.2 :( It seems somehow from the code it is supposed to get called doing the normal cake findAll, save etc and I need it to be called when query() fails as well. Hope someone can help. How do you guys handle when db queries fail? Simon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---