aboutsummaryrefslogtreecommitdiffstats
path: root/lib/action_cable/worker.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-03-25 13:35:01 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-03-25 13:35:01 -0500
commitf29a14207aa3084cb2f0a73cb5672729aa0c6d62 (patch)
treed0ba43a358e4c44a13b66c406ddb7e4975df4631 /lib/action_cable/worker.rb
parent432139183e885f69c6a8f576af7a178842a6e2a1 (diff)
downloadrails-f29a14207aa3084cb2f0a73cb5672729aa0c6d62.tar.gz
rails-f29a14207aa3084cb2f0a73cb5672729aa0c6d62.tar.bz2
rails-f29a14207aa3084cb2f0a73cb5672729aa0c6d62.zip
Close the websocket on exception
Diffstat (limited to 'lib/action_cable/worker.rb')
-rw-r--r--lib/action_cable/worker.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/action_cable/worker.rb b/lib/action_cable/worker.rb
index 6687af43a0..6773535afe 100644
--- a/lib/action_cable/worker.rb
+++ b/lib/action_cable/worker.rb
@@ -9,6 +9,11 @@ module ActionCable
run_callbacks :work do
receiver.send method, *args
end
+ rescue Exception => e
+ logger.error "[ActionCable] There was an exception - #{e.class}(#{e.message})"
+ logger.error e.backtrace.join("\n")
+
+ receiver.handle_exception if receiver.respond_to?(:handle_exception)
end
def run_periodic_timer(channel, callback)
@@ -17,5 +22,9 @@ module ActionCable
end
end
+ private
+ def logger
+ ActionCable::Server.logger
+ end
end
end