From 373aee45f768a3513c3b593196ef212cf4b70ecc Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Mon, 24 Jun 2013 15:30:29 -0400 Subject: [PATCH] Avoid calling translate_exception with non-PGError exceptions. translate_exception was changed and now expects the exception to respond to "result", here: https://github.com/rails/rails/pull/6397 ActiveRecord::StatementInvalid, which is the exception sometimes caught and retried in the "connection retry" logic, does not respond to "result" and fails on the call to translate_exception. Fixes replication test suite failure. This fix can be squashed with the other "connection retry" commit (21e435403bad47a637c2c5d804f0748b66c8d091) on future upgrades. --- .../active_record/connection_adapters/postgresql_adapter.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 1c25285520e9c..2f5341d0ca97e 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -1285,9 +1285,8 @@ def with_auto_reconnect begin yield rescue Exception => e - case translate_exception(e,e.message) - when LostConnection; retry if auto_reconnected? - end + retry if auto_reconnected? && e.message =~ Regexp.union(*lost_connection_messages) + raise end end