GithubHelp home page GithubHelp logo

smartinez87 / exception_notification Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rails/exception_notification

2.2K 2.2K 414.0 946 KB

Exception Notifier Plugin for Rails

Home Page: http://smartinez87.github.io/exception_notification

License: MIT License

Ruby 93.62% HTML 6.38%

exception_notification's People

Contributors

ajain0184 avatar aried3r avatar aschen avatar eitoball avatar elengine avatar emiliocristalli avatar fgrehm avatar flarra avatar fursich avatar fwininger avatar glaszig avatar grzuy avatar j15e avatar jamis avatar josh avatar jweslley avatar knzconnor avatar ktdreyer avatar luaybs avatar martin91 avatar mschnitzer avatar nicolasferraro avatar phoet avatar rubysecret avatar san650 avatar sanemat avatar shanecav84 avatar smartinez87 avatar toshimaru avatar xenofex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exception_notification's Issues

Document ignore_exceptions

I find ignoring exceptions is a common need, and ExceptionNotifier supports the excellent ignore_exceptions option for this but there is very little documentation on it. One must go to the source code to find out how it works. I would love to see a section in the readme dedicated to this option and also mentioning which sections are ignored by default.

Incompatible encoding: ASCII-8BIT and UTF-8

Got an issue with exceptions:

Started POST "/%e7%ae%a1%e7%90%86/products" for 80.36.33.189 at 2012-01-09 14:38:08 +0000
  Processing by Admin::ProductsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"TWKOXRhq3qBmFBoTNHAOm22M/WCNU9lQrnymkAeEczk=", "product"=>{"type"=>"Product::CreditsBundle", "name"=>"200 credits", "amount"=>"120", "data_as_json"=>"{\"amount\":200}", "active"=>"1"}, "commit"=>"Create Product"}
Completed 500 Internal Server Error in 1002ms
Rendered /var/www/mr/shared/bundle/ruby/1.9.1/bundler/gems/exception_notification-192a49a02d63/lib/exception_notifier/views/exception_notifier/_request.text.erb (0.6ms)
Rendered /var/www/mr/shared/bundle/ruby/1.9.1/bundler/gems/exception_notification-192a49a02d63/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.3ms)
Rendered /var/www/mr/shared/bundle/ruby/1.9.1/bundler/gems/exception_notification-192a49a02d63/lib/exception_notifier/views/exception_notifier/_session.text.erb (0.8ms)
Rendered /var/www/mr/shared/bundle/ruby/1.9.1/bundler/gems/exception_notification-192a49a02d63/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms)
Rendered /var/www/mr/shared/bundle/ruby/1.9.1/bundler/gems/exception_notification-192a49a02d63/lib/exception_notifier/views/exception_notifier/_environment.text.erb (2.1ms)
Rendered /var/www/mr/shared/bundle/ruby/1.9.1/bundler/gems/exception_notification-192a49a02d63/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb (29.5ms)

ActionView::Template::Error (incompatible character encodings: ASCII-8BIT and UTF-8):
    1: <% filtered_env = @request.filtered_env -%>
    2: <% max = filtered_env.keys.max { |a, b| a.length <=> b.length } -%>
    3: <% filtered_env.keys.sort.each do |key| -%>
    4: * <%= raw("%-*s: %s" % [max.length, key, inspect_object(filtered_env[key])]) %>
    5: <% end -%>
    6: 
    7: * Process: <%= raw $$ %>

:ignore_if option to accept request/env information

The ignore_if options is a good start, but it could give env as a parameter

https://github.com/smartinez87/exception_notification/blob/master/lib/exception_notifier.rb#L30

@options[:ignore_if]         ||= lambda { |env, e| false }

unless ignored_exception(options[:ignore_exceptions], exception)       ||
           from_crawler(options[:ignore_crawlers], env['HTTP_USER_AGENT']) ||

           options[:ignore_if].call(env, exception)   # < THIS LINE ALSO

      Notifier.exception_notification(env, exception).deliver
      env['exception_notifier.delivered'] = true
end

For us the mailing probability game. I would like to have custom rules like "If no session cookie in request and if user_agent not recognized". This so that we receive exception notifies in most cases but not with new unrecognized bots etc.


In addition to this the ignore_if could be wrapped so that errors inside lambda would not affect. I'm not sure if this should be implemented or left to user. I'm just afraid that when lambda crashes you will lose the exception info and get no email.

ignored_if(options[:ignore_if].call(env, exception))

# wrapper so that if users lambda is errorous it will return true
def ignored_if(lamb, env, exception)
  return lamb.call(env, exception)
rescue Exception => e
  true
end

rails 3.0.10

Hello. I'm trying to get gem working, but without success.

In first case message was sent, in second - no.

ree-1.8.7-2011.03 :008 > begin; raise 'test'; rescue => e; ExceptionNotifier::Notifier.background_exception_notification(e); end
 => #<Mail::Message:...>  
ree-1.8.7-2011.03 :009 > raise 'test'RuntimeError: test
    from (irb):9
    from :0

3.1 support

Hey, just a quick heads up for 3.1 support. It is working, but due to activesupport ~> 3.0.9 being added to the Gemfile I can't use it anymore. Maybe you could loose the dependency to >= 3.0.9?

Creating a separate Email configuration for exception_notification

Hello,

Thanks for all the work you are doing with the exception_notification plugin. It's simple to setup and just works!

I'm using Rails 3.1.3 and have a Mailer already set up and working to deliver various emails. It is configured in an initialiser that looks something like:
https://gist.github.com/1610899#file_email_setup.rb

The app uses another initialiser to setup exception_notification. I got the idea from:
http://stackoverflow.com/a/5490583

On running exception_notification, exceptions get mailed with the settings from the default Mailer. Is it possible to create a separate configuration just for exception_notification to use? If, so how?

Thanks in advance!

Undefined method message in background exception notification

I'm getting an error when trying to send a background exception notification for delayed job. It appears the email view does not have a valid exception object, but I used a debugger and the exception passed was valid (and responded to message). Any idea what could be causing this?

Rendered /Users/cory/.rvm/gems/ruby-1.9.2-p290/gems/exception_notification-2.5.2/lib/exception_notifier/views/exception_notifier/background_exception_notification.text.erb (0.9ms)
ExceptionNotifier failed: ActionView::Template::Error: undefined method `message' for nil:NilClass
  /Users/cory/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/whiny_nil.rb:48:in `method_missing'
  /Users/cory/.rvm/gems/ruby-1.9.2-p290/gems/exception_notification-2.5.2/lib/exception_notifier/views/exception_notifier/background_exception_notification.text.erb:3:in `___sers_cory__rvm_gems_ruby_______p____gems_exception_notification_______lib_exception_notifier_views_exception_notifier_background_exception_notification_text_erb___697306309495317308_70181760388820'

Issue ignoring exceptions in Rails 3.1.3?

After watching Railscast, I implemented exception_notifier on new Rails project. When I tested ignoring specified exceptions these exceptions were not ignored. And when I mean not ignored I continued to get mail (via letter_opener).

Installing in config.ru doesn't work

I placed the code as suggested in config.ru and it does nothing. Not mail is sent. Can someone provide a sample of a config.ru that does work properly?

Using rails 3.09

Unable to find custom section?

Sebastian,

I had a problem porting an app to Rails 3.0 using exception_notification. It didn't seem to be able to find my custom section partial (called "user").

When I changed exception_notification.text.erb as follows, it worked:

<%  sections = @sections.map do |section|
      if section == 'user'
        summary = render('exception_notifier/user').strip
      else
        summary = render(section).strip
      end
      unless summary.blank?
        title = render("title", :title => section).strip
        "#{title}\n\n#{summary.gsub(/^/, "  ")}\n\n"
      end
    end %>

IOW, it looks like it needed the exception_notifier prefix. I'm guessing that I just missed something somewhere. Is this a real issue or am I crazy?

Thanks,

Steve

Manual notification in rake tasks

I presume ExceptionNotifier::Notifier.exception_notification(request.env, exception) would not work in rake tasks since there is no request.env.

What can we pass into the notifier if there is no request.

Ignore exceptions conditionally with block

The ignore_exceptions option is great, but it's only possible to ignore exceptions based on their class. It would be nice if exceptions could be ignored conditionally. Perhaps there could be an option for this where a lambda could be passed in? This could pass information about the current request and the exception.

Great work on the gem.

Using exception_notification with vidibus-routing_error

I have both the exception_notification and vidibus-routing_error gems installed. They work fine individually, but exception_notification doesn't work with vidibus-routing_error enabled.

vidibus-routing_error requires the following code to be added to your application_controller.rb:

if Rails.env.production?
  rescue_from Exception, :with => :render_500
  rescue_from ActionController::RoutingError, :with => :render_404
  rescue_from ActionController::UnknownAction, :with => :render_404
  rescue_from ActiveRecord::RecordNotFound, :with => :render_404
end

private

def render_404
  render "shared/404", :status => 404
end

def render_500
  render "shared/500", :status => 500
end

Since the default Rails exception handling is already preempted by this code, is there a way to call exception_notification from within those two custom actions?

Gem

Hi there,

I noticed you are the new maintainer of exception_notification. I was wondering if you could release a gem with the current state of the code. Currently there is no gem available.

It would be highly appreciated.

Thanks!

No backtrace in some cases

lib/exception_notifier/notifier.rb#clean_backtrace: some exceptions won't have a backtrace, i.e. if an exception object is created. Looks like the background_exception_notification method handles no backtrace, but not exception_notification.

getting ActiveRecord::RecordNotFound emails

If by default ActiveRecord::RecordNotFound is in the default_ignore_exceptions, why am I getting emails for them?

Also, how to add more exceptions to the default_ignore_exceptions?

Avoid :require => 'exception_notifier'

fesplugas reported the following:

With the current published gem something like:

gem 'exception_notification'

Doesn't work. You need to do a explicit require:

gem 'exception_notification', :require => 'exception_notifier'

Can be this be fixed?

No time on background exceptions

Noticing now that background exceptions don't have the time.

Should there be a "system" section that would have this for both normal and background exceptions, and maybe for other data as well?

Background notifications could be DRYer and more complete

Hi — thanks for reviving this project!

So I'm potentially migrating away from Exceptional, which has Exceptional::Catcher.handle_with_controller and Exceptional.handle, which are analogs to ExceptionNotifier::Notifier.exception_notification and ExceptionNotifier::Notifier.background_exception_notification.

a few things about ExceptionNotifier::Notifier.background_exception_notification

  1. it's sort of a second class citizen — it doesn't allow for custom templates
  2. it has repeated code from ExceptionNotifier::Notifier.exception_notification
  3. it's the only thing that can be appropriately used in a model (right?), so it's sort of misnamed

Maybe I'm wrong on 3, and I should just be using ExceptionNotifier::Notifier.exception_notification with an empty environment hash?

Let me know what you think — I'd be interested in cleaning it up, so that there is some sort of common method that is called in all contexts, doesn't repeat code, and reuses the templates.

2.5.0 require error

Using latest Rails 3.1.0.rc8
Everything worked fine with 2.4.1. Since updating to 2.5.0 i'm getting this error in console:

>> ExceptionNotifier
NameError: uninitialized constant ExceptionNotifier
    from (irb):1
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc8/lib/rails/commands/console.rb:45:in `start'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc8/lib/rails/commands/console.rb:8:in `start'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc8/lib/rails/commands.rb:40:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
>> require 'exception_notification'
LoadError: no such file to load -- exception_notification
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:240:in `require'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:240:in `block in require'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:240:in `require'
    from (irb):2
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc8/lib/rails/commands/console.rb:45:in `start'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc8/lib/rails/commands/console.rb:8:in `start'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc8/lib/rails/commands.rb:40:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
>> require 'exception_notifier'
LoadError: no such file to load -- exception_notifier
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:240:in `require'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:240:in `block in require'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0.rc8/lib/active_support/dependencies.rb:240:in `require'
    from (irb):3
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc8/lib/rails/commands/console.rb:45:in `start'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc8/lib/rails/commands/console.rb:8:in `start'
    from /Users/rwz/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0.rc8/lib/rails/commands.rb:40:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Switched back to 2.4.1 for now.

Changes without gemspec bump => bundler won't update

Recent updates (e.g. :verbose_subject option) were committed after the most recent exception_notification.gemspec version bump to 2.5.2.

I'm installing with:

gem "exception_notification"

... but I do not get the latest version. I can see in the source that the gemspec says it's 2.5.2 but the code is not up to date with the most recent commits.

Please excuse if this is normal operation between version bumps, but I find it confusing that online version is not equal to what bundler retrieves for the same gemspec version.

OpenSSL::SSL::SSLError on exception

Simply adding this gem to my gemfile triggers

OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol)

error every time ANY email is sent. Removing this gem allows mail delivery to return to normal...

I'm using rails (3.0.11) and actionmailer (= 3.0.11)

move to the real official repository

Please ask the Rails team to use GitHub's Transfer Ownership feature (in the Admin interface for the repository on GitHub) and give control of the official rails/exception_notification repository to you.

It took me a while to figure out that the official one was deprecated and that yours was to be treated as the official one from now on --- really? a little note in the GitHub repository description... very hard to overlook!

Thanks. 👮

Getting emails for ActiveRecord::RecordNotFound

I'm getting emails for ActiveRecord::RecordNotFound messages:

My configuration:

# We want to be emailed on errors                                                                                                                                             
Chicagoiands::Application.config.middleware.use ExceptionNotifier,                                                                                                            
:email_prefix => "[Chicagoiands] ",                                                                                                                                         
:sender_address => %{"notifier" <[email protected]>},                                                                                                               
:exception_recipients => %w{[email protected]}  

And I get emails for Page not found:

A ActiveRecord::RecordNotFound occurred in stories#show:

Couldn't find Story with id=christian_test
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/relation/finder_methods.rb:340:in `find_one'

This is a Rails 3.2.2 application at: http://github.com/docwhat/chicagoiands

Am I reading the docs wrong? I thought that it should ignore those by default.

Throttling?

It would be nice to have a way to set a limit on how many emails can be sent in a defined time period or of error type. I recently had a situation where an error was being thrown in a loop and got hundreds of emails.

Mailer tries to send even if middleware is disabled

Try running

ExceptionNotifier::Notifier.background_exception_notification e

when you haven't got the middleware enabled.

There is a check in the code to see if the middleware is enabled, but ActionMailer will just try to deliver anyway.

I tried to fix by raising + rescuing a custom error but couldn't fix it :(

Can't send notification manually from ApplicationController

No exception_notifier.options in request.env, I have to set it manually.
I have to do something like that:

def log_error(exception)
if notifier = Rails.application.config.middleware.detect { |x| x.klass == ExceptionNotifier }
env = request.env
env['exception_notifier.options'] = notifier.args.first || {}
ExceptionNotifier::Notifier.exception_notification(env, exception).deliver
env['exception_notifier.delivered'] = true
end
end

How to not ignore default ignored exceptions

Hi,
I am using the 2.5.2 version of the gem, but I want to have mails for all the exceptions I can have. I could not find how to remove the default ignored exceptions, as RoutingError for example.
How can we do that ?
Thanks,
Alex

exception when trying to print env

exception_notification raises an error when it tries to cope with exceptions thrown by couchrest_model:

.../exception_notification-2.5.2/lib/exception_notifier/views/exception_notifier/_request.text.erb (0.1ms)
.../exception_notification-2.5.2/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms)
.../exception_notification-2.5.2/lib/exception_notifier/views/exception_notifier/_session.text.erb (0.5ms)
.../exception_notification-2.5.2/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms)
.../exception_notification-2.5.2/lib/exception_notifier/views/exception_notifier/_environment.text.erb (4.5ms)
.../exception_notification-2.5.2/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb (6.0ms)
ActionView::Template::Error (comparison of Symbol with String failed):
    1: <% filtered_env = @request.filtered_env -%>
    2: <% max = filtered_env.keys.max { |a, b| a.length <=> b.length } -%>
    3: <% filtered_env.keys.sort.each do |key| -%>
    4: * <%= raw("%-*s: %s" % [max.length, key, inspect_object(filtered_env[key])]) %>
    5: <% end -%>
    6: 
  lib/mobile/detection.rb:8:in `call'
  lib/protocol/writer.rb:17:in `call'
  lib/support/char_converter.rb:15:in `call'
Completed 500 Internal Server Error in 248.5ms (Views: 210.179ms | CouchDB: 16.243ms(3q))

this is due to the fact that the filtered_env is supposed to return only one type (String/Symbol) but returns a mix.

Setting Headers for Email

Hello,

I am using Mailgun, and I would like to be able to set a header for my exception emails:

X-Mailgun-Track: no

This is useful because usually I would like mailgun to rewrite my urls for tracking, but for exception notifications I do not want them rewritten. Is there a way for me to configure this with ExceptionNotification?

background_exception_notification parameters differ

I'm using exception_notification 2.5.2 and getting an exception when I try to call background_exception_notification with 2 arguments (exception and data), as described in the readme.

Looking at the gem code I have, the method is def background_exception_notification(exception), but in github, the latest method is def background_exception_notification(exception, options={}).

Is this a recent change not in 2.5.2 code ?

uninitialized constant ExceptionNotifier (NameError)

Running 2.6.1 works great in development & production mode locally but kills the live server dead with the below error in my Unicorn log.

unicorn:23:in

'
E, [2012-06-16T06:36:35.750075 #756] ERROR -- : reaped #<Process::Status: pid 6425 exit 1> worker=1
I, [2012-06-16T06:36:35.750728 #756] INFO -- : worker=1 spawning...
I, [2012-06-16T06:36:35.763471 #6437] INFO -- : worker=1 spawned pid=6437
I, [2012-06-16T06:36:35.764618 #6437] INFO -- : Refreshing Gem list
E, [2012-06-16T06:36:36.271654 #6428] ERROR -- : uninitialized constant ExceptionNotifier (NameError)`

I've tried the "require => exception_notifier" option and a few other classics from stackoverflow but still no luck. Have tried as middleware in config.ru and in production.rb, same error for both.

This may well be my fault but I'm not sure how to diagnose it any deeper than the options I've tried and I can't find any major differences between my live and local configs.

workaround for missing consider_local?

the pre-middleware-version had an option (consider_local) to set ip addresses which should not trigger notifier but show exception as in development mode:

class ApplicationController < ActionController::Base
include ExceptionNotifiable

ips = %w[127.0.0.1 192.168.0.1 192.168.0.2 192.168.0.3]
consider_local(*ips)
end

is there any other middleware or workaround to achieve this with the current version?

Unfiltered Password

If someone submits a password in a form, and an error triggers exception_notification, the password is shown in plain-text under "action_controller.request.request_parameters", "rack.request.form_hash", and "rack.request.form_vars" (even though params is filtered properly). Using Rails 2.3.

Background notification not working with delayed_job

From delayed job instructions:

Due to how mailers are implemented in Rails 3, we had to do a little work around to get delayed_job to work.

without delayed_job

Notifier.signup(@user).deliver

with delayed_job

Notifier.delay.signup(@user)
Remove the .deliver method to make it work. It’s not ideal, but it’s the best we could do for now.

The method that sends the background_notification is using the deliver option. See:

mail(:to => @options[:exception_recipients], :from => @options[:sender_address], :subject => subject) do |format|
format.text { render "#{mailer_name}/background_exception_notification" }
end.deliver

This method should be written using 'delay' instead of deliver to make it work with delayed_job.

ActionDispatch::Cookies::CookieOverflow not reported

I found that a certain path through my Rails code was triggering an ActionDispatch::Cookies::CookieOverflow. Unfortunately exception_notification did not email me (I only found out when I received a phone call from a customer).

Can we get this exception_notification to handle this error?

exception notification is failing with a "comparison of symbol with string failed" error

I have a new site I am working on and the exception_notification gem seems to be not working. Not sure why, but here is what I am seeing every time an error is generated. Site is Rails 3.1.3, Ruby 1.9.2.

Showing /Users/aesthetica/.rvm/gems/ruby-1.9.2-p290@ppigraphics/gems/exception_notification-2.5.2/lib/exception_notifier/views/exception_notifier/_environment.text.erb where line #3 raised:

comparison of Symbol with String failed
Extracted source (around line #3):

1: <% filtered_env = @request.filtered_env -%>
2: <% max = filtered_env.keys.max { |a, b| a.length <=> b.length } -%>
3: <% filtered_env.keys.sort.each do |key| -%>
4: * <%= raw("%-*s: %s" % [max.length, key, inspect_object(filtered_env[key])]) %>
5: <% end -%>
6:

exception_notification can't work with rescue_from

I wanna customize my dynamic error pages instead of the static html pages such as 404.html 500.html in public folder in my rails3 app. So i put these codes in my application_controller.rb
def self.rescue_errors
rescue_from Exception, :with => :render_error
rescue_from RuntimeError, :with => :render_error
rescue_from ActiveRecord::RecordNotFound, :with => :render_not_found
rescue_from ActionController::RoutingError, :with => :render_not_found
rescue_from ActionController::UnknownController, :with => :render_not_found
rescue_from ActionController::UnknownAction, :with => :render_not_found
end

rescue_errors unless Rails.env.development?

def render_not_found(exception = nil)
render :template => "errors/404", :status => 404, :layout => 'application'
end

def render_error(exception = nil)
render :template => "errors/500", :status => 500, :layout => 'application'
end

now the custom error pages work fine, but no mail sent when exception generated.
After debugging the app, i found the def call (env) method in exception_notification.rb doesn't excute the code below after @app.call(env)
rescue Exception => exception
options = (env['exception_notifier.options'] ||= {})
options.reverse_merge!(@options)

unless Array.wrap(options[:ignore_exceptions]).include?(exception.class)
  Notifier.exception_notification(env, exception).deliver
  env['exception_notifier.delivered'] = true
end

raise exception

end
But exception_notification works fine without the codes for custom dynamic error pages in application_controller.rb.
So i wanna know if there is a solution works with exception_notification and custom error pages in rails3. rescue_action_in_public is now as a middleware in actiondispath showexceptions and can't overwrite it in application_controller.rb

background_exception_notification doesn't seem to be searching in my app views

Using version 2.6.0 with rails 3.2.2, ruby 1.8.7.

Finally started using the background_exception_notification section and ran into an error where it looks like my custom section is not being found..
I am using my own custom section (from environment.rb):

      :sections => %w{instructions_for_support} + ExceptionNotifier::Notifier.default_sections,
      :background_sections => %w{instructions_for_support} + ExceptionNotifier::Notifier.default_background_sections
  }

(other parts are set elsewhere).

The instructions_for_support partial is being found just fine when I use the exception_notifier method, but it's not finding it when I use background_exception_notification. To investigate I renamed the partial so it wouldn't be found.

With exception_notification I get this message:

Missing partial exception_notifier/instructions_for_support with {:formats=>[:text], :locale=>[:en], :handlers=>[:coffee, :erb, :builder]}. Searched in:
    * "/home/bselig/.rvm/gems/ruby-1.8.7-p334@Upgrade32/gems/exception_notification-2.6.0/lib/exception_notifier/views"
    * "/mnt/dev_shared_codebase/Upgrade_Rails_32x/app/views"

and with background_exception_notification I get this error:

Missing partial exception_notifier/instructions_for_support with {:formats=>[:text], :locale=>[:en], :handlers=>[:coffee, :erb, :builder]}. Searched in:
  * "/home/bselig/.rvm/gems/ruby-1.8.7-p334@Upgrade32/gems/exception_notification-2.6.0/lib/exception_notifier/views"

As you can see, exception_notification is searching in my app's views folder while background_exception_notification is not.
The difference seems to be this line:

      self.append_view_path Rails.root.nil? ? "app/views" : "#{Rails.root}/app/views" if defined?(Rails)

which is at the beginning of exception_notification but not background_exception_notification.

Am I misunderstanding something or is this just an oversight in the code?

custom section partials not found in view path

This guy explains the issue nicely: http://stackoverflow.com/questions/5389754/custom-partials-in-exception-notification-in-rails-3

But basically, the view path for the gem seems to be specific to the gem's location and does not consult the app's view path. Is there any help for this or am I just doing it wrong perhaps?

I tried adding a section called highlights to options[:sections] and started receiving the error:

Missing partial exception_notifier/highlights with {:locale=>[:en], :handlers=>[:rjs, :rhtml, :rxml, :erb, :builder], :formats=>[:text]} in view paths "C:/Ruby187/lib/ruby/gems/1.8/gems/exception_notification-2.4.0/lib/exception_notifier/views"

Thanks

Missing recipient addresses when using Exim?

I'm using Rails-3.0.6 and exception_notification-2.4.0. I've configured Rails for sendmail:

config.action_mailer.delivery_method = :sendmail

My sendmail replacement is Exim4, the lastest Ubuntu/Debian package. When there is an exception, an email is sent, but it is an error message from Exim:

A message that you sent using the -t command line option contained no
addresses that were not also on the command line, and were therefore
suppressed. This left no recipient addresses, and so no delivery could
be attempted.

------ This is a copy of your message, including all the headers. ------
{{snip}}

Is it possible that Exim is too strict and something is missing?

Thanks,
Michael

session hash mostly missing?

Using Rails 3.0.9, all the exception notifications we get seem to be missing most of the session data. Is this a consequence of exception_notification moving down to the middleware level and not seeing the Rails-specific stuff? Example session partial:

session id: nil

  • data: {"_csrf_token"=>"some_stuff",
    "warden.user.user.key"=>["User", [10618], "some_stuff"]}

Filter session ID

The session ID should be filtered, particularly for secure requests.

Exception notifier failing to get settings

Rails 3.2.1

Gemfile

gem 'exception_notification', :git => 'git://github.com/smartinez87/exception_notification.git'

Config.ru

Blah::Application.config.middleware.use ExceptionNotifier,
:email_prefix => '[Blah] ',
:sender_address => '"Blah" [email protected]',
:exception_recipients => ['[email protected]']

Trying to test if exception notifier is working at all from the rails console:

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

sendmail: fatal: [email protected](501): No recipient addresses found in message header
postdrop: warning: stdin: unexpected EOF in data, record type 78 length 116
postdrop: fatal: uid=501: malformed input
=> #<Mail::Message:2170288820, Multipart: false, Headers: <Date: Thu, 07 Jun 2012 17:47:06 -0300>, <From: "Exception Notifier" [email protected]>, <To: >, <Message-ID: [email protected]>, <Subject: [ERROR] # (Exception) "exception message">, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>

Sending bug-report in attachment

It would be a great if exception_notification can be configured when mail body contains some readable for common users text (something like "We're sorry, but there's error on page bla-bla-bla."), and full bug report is attached as text file.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.