Rails Exception Notification Plugin - Force send email
I figured out how to do this. Here's the code that you would put in your controller to trigger the email.
For the Rails 2.3 version of the Exception_Notification plugin:
begin 10 / 0rescue Exception => e ExceptionNotifier.deliver_exception_notification(e, self, request)end
For the Rails 3 version of the Exception_Notification plugin:
begin 10 / 0rescue Exception => e ExceptionNotifier::Notifier.exception_notification(request.env, e).deliverend
For the Rails 4 version (currently v4.0.1 of the exception_notification gem):
begin some code...rescue => e ExceptionNotifier.notify_exception(e) ExceptionNotifier.notify_exception(e, env: request.env, data: { message: "oops" })end
Exception Notifier is specifically designed for catching uncaught errors. Once you catch the error its up to you to send the email message yourself. The quick and dirty way is to trigger the exception mailer code when you catch the exception. I can't recall how the method off the top of my head, but a quick look in the plugin should yield you results. Look for the render_exception_in_public (or something like it) for the mailer code.