diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2015-04-08 16:01:40 -0500 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2015-04-08 16:01:40 -0500 |
commit | 58058bdecfcd7cbe24baec2593f333b46960374e (patch) | |
tree | 05460220400ee5519ce1d760e8ca48c52b937e31 /lib/action_cable/connection | |
parent | 6789dd81bdcfbea8bba2f128f59990829439503f (diff) | |
download | rails-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.rb | 8 |
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 |