ActionCable Error (undefined method `rescue_from')

Dear All,

I am facing the issue in action cable rescue from_block.

module ApplicationCable
  class Connection < ActionCable::Connection::Base
  	rescue_from Exception, with: :report_error
private
    def report_error(e)
      ::Project.logger.error(e)
    end
  end
end

Followed Link Action Cable Overview — Ruby on Rails Guides

Getting Error: on console

NoMethodError (undefined method `rescue_from’ for ApplicationCable::Connection:Class Did you mean? rescue):

Please let me know where is the mistake, or what I have missed. Thanks

1 Like

rescue_from comes from ActiveSupport::Rescuable::ClassMethods which is not included in the ActionCable base class you’re using. It’s included in the ActionController

rescue_from support is coming in Rails 6.1; it hasn’t been released yet (and you’re looking at the edge guides).

2 Likes

Thanks @Vlad_Dem. I Got this.