Search code examples
ruby-on-railsexception-notification

ExceptionNotifier.notify_exception not working


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


Solution

  • 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.