Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add_filter throwing exception #8

Closed
jschuman opened this issue Dec 22, 2015 · 1 comment
Closed

add_filter throwing exception #8

jschuman opened this issue Dec 22, 2015 · 1 comment
Labels

Comments

@jschuman
Copy link

Migrating from 4.3.4 to 5.0.1 and when I try to configure Airbrake using an inline add_filter, I'm getting an exception.

I've got the add_filter just like in the migration_guide for testing purposes:

Airbrake.add_filter do |notice|
  if notice[:errors].any? { |error| error[:type] == 'RuntimeError' }
    notice.ignore!
  end
end

In a rails console I try this:

2.1.6 :003 > e = Exception.new("Hello World")
 => #<Exception: Hello World> 
2.1.6 :004 > Airbrake.notify(e)
NoMethodError: undefined method `call' for nil:NilClass
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/airbrake-ruby-1.0.0/lib/airbrake-ruby/filter_chain.rb:64:in `block in refine'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/airbrake-ruby-1.0.0/lib/airbrake-ruby/filter_chain.rb:62:in `each'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/airbrake-ruby-1.0.0/lib/airbrake-ruby/filter_chain.rb:62:in `refine'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/airbrake-ruby-1.0.0/lib/airbrake-ruby/notifier.rb:123:in `send_notice'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/airbrake-ruby-1.0.0/lib/airbrake-ruby/notifier.rb:45:in `notify'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/airbrake-ruby-1.0.0/lib/airbrake-ruby.rb:280:in `call_notifier'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/airbrake-ruby-1.0.0/lib/airbrake-ruby.rb:134:in `notify'
    from (irb):4
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in `start'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
    from /Users/jschuman/.rvm/gems/ruby-2.1.6@kona/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

If I switch the filter to be a class and new up that class in the add_filter call then it works fine.

@kyrylo kyrylo added the Bug label Dec 22, 2015
@kyrylo
Copy link
Contributor

kyrylo commented Dec 22, 2015

Hey, thanks for the report! It's a bug. I'm already working on the fix.

kyrylo added a commit that referenced this issue Dec 22, 2015
Fixes #8 (add_filter throwing exception)
kyrylo added a commit that referenced this issue Dec 22, 2015
Fixes #8 (add_filter throwing exception)
kyrylo added a commit that referenced this issue Dec 22, 2015
Fixes #8 (add_filter throwing exception)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants