lib/anycable/rails/actioncable/connection.rb in anycable-rails-1.0.0.rc4 vs lib/anycable/rails/actioncable/connection.rb in anycable-rails-1.0.0
- old
+ new
@@ -196,5 +196,18 @@
end
end
# rubocop:enable Metrics/ClassLength
end
end
+
+# Support rescue_from
+# https://github.com/rails/rails/commit/d2571e560c62116f60429c933d0c41a0e249b58b
+if ActionCable::Connection::Base.respond_to?(:rescue_from)
+ ActionCable::Connection::Base.prepend(Module.new do
+ def handle_channel_command(*)
+ super
+ rescue Exception => e # rubocop:disable Lint/RescueException
+ rescue_with_handler(e) || raise
+ false
+ end
+ end)
+end