aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/connection
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-04-08 16:01:40 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-04-08 16:01:40 -0500
commit58058bdecfcd7cbe24baec2593f333b46960374e (patch)
tree05460220400ee5519ce1d760e8ca48c52b937e31 /lib/action_cable/connection
parent6789dd81bdcfbea8bba2f128f59990829439503f (diff)
downloadrails-58058bdecfcd7cbe24baec2593f333b46960374e.tar.gz
rails-58058bdecfcd7cbe24baec2593f333b46960374e.tar.bz2
rails-58058bdecfcd7cbe24baec2593f333b46960374e.zip
Print exception class and message in the logs
Diffstat (limited to 'lib/action_cable/connection')
-rw-r--r--lib/action_cable/connection/base.rb8
1 files changed, 6 insertions, 2 deletions
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