From: Pim S. <pi...@li...> - 2008-05-19 20:26:28
|
Op 19 mei 2008, om 19:34 heeft Eloy Duran het volgende geschreven > Hi Pim, > > Ideally you'd want to rescue it in #rbValueForKey, something like: > > class ProjectProxy > def rbValueForKey(key) > super > rescue ActiveRecord::StatementInvalid => e # that's apparently > what it raises for a lost connection > # do some reporting and reconnect or what have you not... > puts e.message > puts e.backtrace > end > end Thanks Eloy! This is exactly what I was looking for, and it is working. This will stop a lot of crashes ;) > If this gives the desired result and you come up with a good > universal solution don't mind to send a patch ;) I think I'm not ready for sending patches as I'm still learning Ruby and Cocoa and I'm a real novice. I do know I'll stick to RubyCocoa and ActiveRecord so perhaps later on. > On 19 mei 2008, at 19:11, Pim Snel wrote: > >> To be more complete: >> >> Issue Load (0.000000) Mysql::Error: Lost connection to MySQL >> server during query: SELECT id, subject, project_id FROM `issues` >> WHERE (issues.project_id = 55 AND status_id < 5) >> 2008-05-19 15:43:29.340 TimeToTicket[13026:10b] >> ProjectProxy#rbValueForKey: ActiveRecord::StatementInvalid: >> Mysql::Error: Lost connection to MySQL server during query: SELECT >> id, subject, project_id FROM `issues` WHERE (issues.project_id = >> 55 AND status_id < 5) >> >> But where should I add this begin/rescue/end block? In an >> overruling function in ProjectProxy in this case? >> >> >> Op 19 mei 2008, om 17:11 heeft Patrick Geiller het volgende >> geschreven: >> >>> >>> >>>> Mysql::Error: Lost connection to MySQL server during query. >>> >>> Is this error thrown by Ruby ? In that case you should be able to >>> wrap the offending code with begin / rescue / end. |