diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 16:15:18 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-01-02 16:15:18 -0300 |
commit | 3793b4063ada64502d0c8221ddacab35b2e7f7ea (patch) | |
tree | 4a5a3e0aaf43fd91a815b5c64fe4399e0c00d84f /activerecord/lib/active_record/connection_adapters | |
parent | dbe7fe289c8f32250bf6161e466d52f9d90154cf (diff) | |
parent | c46ff516a25684a2d04d453b2db44d6fa224c350 (diff) | |
download | rails-3793b4063ada64502d0c8221ddacab35b2e7f7ea.tar.gz rails-3793b4063ada64502d0c8221ddacab35b2e7f7ea.tar.bz2 rails-3793b4063ada64502d0c8221ddacab35b2e7f7ea.zip |
Merge pull request #8547 from printercu/patch-1
fix for messages in invalid encoding from db-drivers
Conflicts:
activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
activerecord/test/cases/connection_adapters/abstract_adapter_test.rb
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_adapter.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb index a8453b2bae..fa24d9b43f 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb @@ -457,7 +457,12 @@ module ActiveRecord end def translate_exception_class(e, sql) - message = "#{e.class.name}: #{e.message}: #{sql}" + begin + message = "#{e.class.name}: #{e.message}: #{sql}" + rescue Encoding::CompatibilityError + message = "#{e.class.name}: #{e.message.force_encoding sql.encoding}: #{sql}" + end + @logger.error message if @logger exception = translate_exception(e, message) exception.set_backtrace e.backtrace |