diff --git a/contrib/ruby/lib/trilogy.rb b/contrib/ruby/lib/trilogy.rb index 9b3a8835..f78da9c7 100644 --- a/contrib/ruby/lib/trilogy.rb +++ b/contrib/ruby/lib/trilogy.rb @@ -51,7 +51,15 @@ def initialize(error_message = nil, error_code = nil) end end + # DatabaseError was replaced by ProtocolError, but we'll keep it around as an + # ancestor of ProtocolError for compatibility reasons (e.g. so `rescue DatabaseError` + # still works. We can remove this class in the next major release. + module DatabaseError + end + class ProtocolError < BaseError + include DatabaseError + ERROR_CODES = { 1205 => TimeoutError, # ER_LOCK_WAIT_TIMEOUT 1044 => BaseConnectionError, # ER_DBACCESS_DENIED_ERROR diff --git a/contrib/ruby/test/client_test.rb b/contrib/ruby/test/client_test.rb index 389ae7a6..4ec11f85 100644 --- a/contrib/ruby/test/client_test.rb +++ b/contrib/ruby/test/client_test.rb @@ -702,6 +702,7 @@ def test_too_many_connections end assert_equal 1040, ex.error_code + assert ex.is_a?(Trilogy::DatabaseError) ensure accept_thread.join fake_server.close