Exception Notification plugin not working with Rails 2.1?

We seemed to stop getting exception notifications in an app that's using Rails 2.1 recently, and I did some digging to try and figure out what the problem was. I think I'm onto the issue, but it would appear that my Ruby-fu is still too weak to find a solution just yet.

Here's a failing test with the plugin in a fresh Rails 2.1 app:

http://pastie.org/208968

I think it may be related to this commit, but I'm not sure:

http://github.com/rails/rails/commit/8d37bd08eeac6d0e94f76ac6640e288bf64595b2

Thanks to github for the awesome search feature :slight_smile:

http://github.com/rails/rails/search?q=filter_parameters&choice=grep

I think that making filter_parameters protected caused the issue somewhere around here:

http://github.com/rails/exception_notification/tree/master/lib/exception_notifier_helper.rb#L64

That might be causing this test to fail:

http://github.com/rails/exception_notification/tree/master/test/exception_notifier_helper_test.rb#L46

Any help would be appreciated!

Thanks, - Trevor

Any help would be appreciated!

If it's just about making the method protected you should be able to change:

@controller.filter_parameters(parameters)

to

@controller.send(:filter_parameters, parameters)

Thanks for your reply, Koz. This strategy you suggested appears to fix the issue of the plugin not sending emails when exceptions are raised in an app using Rails 2.1:

http://github.com/trevorturk/exception_notification/commit/9b3b0eca97ca27af6844ffc81ee6190ce022b364

Perhaps someone with commit access to the Rails github would consider making this change in the official plugin?

Here is a ticket about the issue of the plugin not being compatible with Rails 2.1: http://rails.lighthouseapp.com/projects/8995/tickets/15-rails-2-1-0-filter_parameter_logging-crashes-exception_notifiable

Here is a ticket about the (separate?) issue of the (still) failing test: http://rails.lighthouseapp.com/projects/8995/tickets/11-exception_notifiable-test-failure

I'm just chiming in to confirm this bug and the suggested fix -- but shouldn't this be tracked as an exception_notifier bug, not a rails bug?

After the above mentioned fix you may find another error.

Also fixed similarly as above, this time on exception_notifier_helper line 76:

From:

return @controller.filter_parameters({env_key => env_value}).values[0]

To:

return @controller.send(:filter_parameters, {env_key => env_value}).values[0]

I've added this info to the lighthouse ticket: http://rails.lighthouseapp.com/projects/8995-rails-plugins/tickets/15