pboling / exception_notification

[Super] Exception Notifier Gem/Plugin for Rails
https://github.com/pboling/exception_notification
MIT License
65 stars 4 forks source link

issue while integrating exception_notification to custom app #17

Open austymenko opened 14 years ago

austymenko commented 14 years ago

Hello, probably somebody had similar issue on rails 3, then pls put any comments on this issue.

Seems I did all necessary set up steps: 1) installed gem (gem install super_exception_notifier)

2) application.rb require 'exception_notification'

3) created config/initializers/exception.rb

ExceptionNotification::Notifier.configure_exception_notifier do |config|

If left empty web hooks will not be engaged

config[:web_hooks] = [] config[:app_name] = "[APP]" config[:sender_address] = "some@address.com" ETC... end

4) added "include ExceptionNotification::ExceptionNotifiable" to app/controllers/application_controller.rb

class ApplicationController < ActionController::Base include ExceptionNotification::ExceptionNotifiable

Comment out the line below if you want to see the normal rails errors in normal development.

alias :rescue_action_locally :rescue_action_in_public if Rails.env == 'development'

self.error_layout = 'errors'

self.exception_notifiable_verbose = true #SEN uses logger.info, so won't be verbose in production

self.exception_notifiable_pass_through = :hoptoad # requires the standard hoptoad gem to be installed, and setup normally

self.exception_notifiable_silent_exceptions = [MethodDisabled, ActionController::RoutingError]

specific errors can be handled by something else:

rescue_from 'Acl9::AccessDenied', :with => :access_denied

After running app, getting an error "undefined method `codes_for_error_classes' for ExceptionNotification::ExceptionNotifiable:Module". Current issue happens in module ExceptionNotification::ExceptionNotifiable at the line "base.error_class_status_codes = self.codes_for_error_classes", which don't see method codes_for_error_classes located in the module ExceptionNotification::HelpfulHashes.

Seems like module ExceptionNotification::HelpfulHashes (helpful_hashes.rb) with its method "codes_for_error_classes" is not in the chain of exception_notification calls. But I verified that module ExceptionNotification was trying to autoload necessary pieces along with "autoload :HelpfulHashes, 'exception_notification/helpful_hashes'

thanks, Alex

pboling commented 14 years ago

I have never tested it with rails 3, thanks for the feedback. I will look into Rails 3 compatibility soon.

austymenko commented 14 years ago

thanks, Alex

hsribei commented 14 years ago

@pboling do you think a lot would have to be changed to make it work with rails3 (in case someone wants to dive in)?

pboling commented 14 years ago

Good question. I know that the rails core version from which this is forked is changed a lot for rails 3. I am not sure how much of that refactoring is 'required' and how much is just refactoring. I have already refactored a lot of the code in my branch to structure it more like the code in the new rails 2.3 branch of the core repo. I hope to have time to work on a rails 3 compatible version of my fork soon. I will keep separate rails 2.3 (currently master) and rails 3 branches because I am sure the rails 3 version will not be backwards compatible with rails 2 (without a lot of extra work).

It would be great for someone else to jump in!

hsribei commented 14 years ago

Not promising anything, but I'll start taking a look at the code. I'm already going through some hell porting shapado (obvio171/shapado) anyway, so some of what I'm learning in the process might be useful. Is there any place on IRC where you hang out? I'm at #shapado most of the time.

hsribei commented 14 years ago

Btw, since it's such a different project already with likely irreconcilable differences, would this maybe be the opportunity to take it into its own different project instead of being a fork? I'm not familiar with the code base, but is there still a lot of code shared between your version and rails's?

hsribei commented 14 years ago

Ok, I'm officially going to port super_exception_notifier to Rails 3 now. Unavoidable tangle of a now-recursive port.

triemstr commented 13 years ago

Any luck porting to Rails 3? Or is that a no-go now....

austymenko commented 13 years ago

I've used exception_notification gem in my other Rails 3.0.4 app, and it worked just fine.

triemstr commented 13 years ago

austymenko, how did you get past the 'codes_for_error_classes' problem you originally discussed? If you have this gem working with Rails 3.0.4 you must have made some fix? Or do you mean you are using the rails exception_notification branch now?

pboling commented 13 years ago

I think austymenko is referring to the original exception_notifier gem, not this 'super' one.

@obvio171: I am not sure how to make this gem stop being a fork of exception notifier. The standard exception notifier changed a great deal between the version for rails 2 and 3. I imagine 'super' will have a lot of changes as well. I will soon begin working on this rails 3 upgrade as well. If you do your work in a branch we can collaborate on the upgrade.