El Viernes, 4 de Septiembre de 2009, Iñaki Baz Castillo escribió: > I've also realized that when using MySQL, if the database is stopped (or > there is a network/socket error) then when performing a query I get the > folowing exception: > > Mysql::Error - Can't connect to local MySQL server through socket > '/var/run/mysqld/mysqld.sock' > > This is, the raised exception is totally dependant on the adapter. > Shouldn't Sequel capture these exception and convert them to a generic > Sequel exception? If not, I should add: > rescue Mysql::Error, Postgress::ConnectionError ... > and so, which is not very cool.
By reading RDoc I find an exception Sequel::DatabaseDisconnectError. Why didn't it occur to me? My scenario is simple: - My code does the #connect. - Then creates a prepared stament. - Runs as daemon. - For each HTTP query it uses the prepared stament to perform a query. - Then I stop MySQL. - The next query receives "MySQL::Error" exception. PS: I'm using Rack and I think it uses Ruby threads which prevent errors to be printted... -- Iñaki Baz Castillo <[email protected]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" 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/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
