From 58058bdecfcd7cbe24baec2593f333b46960374e Mon Sep 17 00:00:00 2001
From: Pratik Naik <pratiknaik@gmail.com>
Date: Wed, 8 Apr 2015 16:01:40 -0500
Subject: Print exception class and message in the logs

---
 lib/action_cable/connection/base.rb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'lib/action_cable')

diff --git a/lib/action_cable/connection/base.rb b/lib/action_cable/connection/base.rb
index 76d6f5da9e..8eec9d2a82 100644
--- a/lib/action_cable/connection/base.rb
+++ b/lib/action_cable/connection/base.rb
@@ -116,7 +116,7 @@ module ActionCable
           end
         rescue Exception => e
           logger.error "[ActionCable] Could not subscribe to channel (#{data.inspect})"
-          logger.error e.backtrace.join("\n")
+          log_exception(e)
         end
 
         def process_message(message)
@@ -127,7 +127,7 @@ module ActionCable
           end
         rescue Exception => e
           logger.error "[ActionCable] Could not process message (#{message.inspect})"
-          logger.error e.backtrace.join("\n")
+          log_exception(e)
         end
 
         def unsubscribe_channel(data)
@@ -170,6 +170,10 @@ module ActionCable
             Time.now.to_default_s ]
         end
 
+        def log_exception(e)
+          logger.error "[ActionCable] There was an exception - #{e.class}(#{e.message})"
+          logger.error e.backtrace.join("\n")
+        end
     end
   end
 end
-- 
cgit v1.2.3