rollbar-gem icon indicating copy to clipboard operation
rollbar-gem copied to clipboard

Exception level filter not working for custom exception

Open arahman4710 opened this issue 1 year ago • 2 comments

Hey rollbar team,

I'm trying to ignore a specific exception but its not working

In my initializer/rollbar.rb, I have

config.exception_level_filters.merge!('CustomAuthenticationError' => 'ignore')

and I'm raising CustomAuthenticationError which is the following code:

class CustomAuthenticationError < StandardError
  def initialize(message = nil)
    super(message)
  end
end

Ignoring ActionController::RoutingError works just not for my own exception. What am i missing?

Thanks!

arahman4710 avatar Apr 09 '24 03:04 arahman4710

I tested here, and it's working for me. Is it possible the error class is nested?

Something like this

class TestController < ApplicationController
  class TestError < StandardError; end
end

will need to use

config.exception_level_filters.merge!('TestController::TestError' => 'ignore')

Otherwise, the filter depends on exception.class.name. You could try printing this for your exception class to be sure it matches the string you're using.

waltjones avatar Apr 09 '24 16:04 waltjones

@arahman4710 are you still having trouble with this? Were you able to test what @waltjones proposed?

alif avatar Jun 12 '24 18:06 alif