ExceptionNotifier.notify_exception not working
Asked Answered
R

2

6

We are using this gem(https://github.com/smartinez87/exception_notification) with rails 3.2.11. We want to use following method "ExceptionNotifier.notify_exception(e)" from action of controller and from background process as mentioned on the wikie but we are getting following error

undefined method `notify_exception' for ExceptionNotifier:Class

We are installing 3.0.1 version of this gem. gem "exception_notification", "~> 3.0.1"

Our rails version is 3.2.11 and ruby version is ruby 1.9.2p320.

Thanks

Raised answered 15/4, 2013 at 18:32 Comment(0)
R
7

You're reading an API for notify_exception for a version that has yet to be released as a gem.

You can either point your Gemfile at the git repo

gem "exception_notification", git: "git://github.com/smartinez87/exception_notification.git"

or use the proper API call for 3.0.1

ExceptionNotifier::Notifier.exception_notification(request.env, exception,
:data => {:message => "was doing something wrong"}).deliver

The docs for 3.0.1 are here.

Redress answered 5/5, 2013 at 19:30 Comment(2)
Ah, yes good to read the screaming text at the top of the github repo: THIS README IS FOR THE MASTER BRANCH AND REFLECTS THE WORK CURRENTLY EXISTING ON THE MASTER BRANCH. IF YOU ARE LOOKING FOR DOCUMENTATION OF AN ALREADY RELEASED VERSION OF EXCEPTION NOTIFICATION, PLEASE CONSULT THAT ON THE README OF THE TAG FOR THAT VERSION AND NOT THIS ONE.Superphosphate
To be fair to OP, it wasn't until almost a week after this Question was created that anything resembling such a helpful not was added to the README. github.com/smartinez87/exception_notification/commits/master/… Seems you're far from the only one who ran into trouble :-)Redress
H
2

In your gem file just write this line

gem 'exception_notification' , '3.0.1'

and after that

bundle install

this works for me :)

Hamby answered 7/9, 2013 at 5:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.