Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 371
junaidmalik Avatar asked Apr 15 '13 18:04

junaidmalik


People also ask

Why am I getting so many notifications from exceptionnotification?

In general, ExceptionNotification will send a notification when every error occurs, which may result in a problem: if your site has a high throughput and a particular error is raised frequently, you will receive too many notifications.

What is exception notification in rails?

Exception Notification. The Exception Notification gem provides a set of notifiers for sending notifications when errors occur in a Rack/Rails application. The built-in notifiers can deliver notifications by email, Campfire, HipChat, Slack, Mattermost, IRC, Amazon SNS or via custom WebHooks.

What is the exception notification gem?

The Exception Notification gem provides a set of notifiers for sending notifications when errors occur in a Rack/Rails application. The built-in notifiers can deliver notifications by email, Campfire, HipChat, Slack, Mattermost, Teams, IRC, Amazon SNS, Google Chat, Datadog or via custom WebHooks.

How do I use exceptionnotification as an engine?

In order to use ExceptionNotification as an engine, just run the following command from the terminal: This command generates an initialize file ( config/initializers/exception_notification.rb) where you can customize your configurations.


2 Answers

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.

like image 135
deefour Avatar answered Oct 09 '22 16:10

deefour


In your gem file just write this line

gem 'exception_notification' , '3.0.1'

and after that

bundle install

this works for me :)

like image 38
manish nautiyal Avatar answered Oct 09 '22 16:10

manish nautiyal