I am using ActiveRecord to create a connection to a database in a thor script. The adapter I am using in this case is mysql2. I want to add some rescue blocks to my code in order to offer some specific error messages to users.
When I turn off the mysql server on my localhost and tried to connect (using establish_connection) I get the following error (as expected)
Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (Mysql2::Error)
Why am I not getting an ActiveRecord::ConnectionNotEstablished error instead of the Mysql2::Error? The reason I ask is that Mysql2 does not have specific error types(based on https://github.com/brianmario/mysql2/blob/master/lib/mysql2/error.rb) whereas active record does( http://api.rubyonrails.org/files/activerecord/lib/active_record/errors_rb.html)
Using ruby 1.9.3 and activerecord 3.2.8 with mysql2 0.3.11
Thanks!