Closed deeeki closed 10 years ago
Thanks for the report. Can you give an example stack trace of the kind of error this is fixing? Also, can you elaborate a bit how exactly to trigger the error?
Thanks for your reply.
config/environments/development.rb
following READMERails.application.configure do
# omitted...
config.middleware.use ExceptionNotification::Rack,
:ignore_if => lambda { |env, exception| !env[:rake?] },
:email => {
:sender_address => %{"notifier" <sender.address@example.com>},
:exception_recipients => %w{your.email@example.com}
}
ExceptionNotifier::Rake.configure
end
task :failing_task => :environment do
FAIL!
end
Then I got the mail as below.
A NoMethodError occurred in #:
undefined method `FAIL!' for main:Object
lib/tasks/dev.rake:2:in `block in <top (required)>'
-------------------------------
Request:
-------------------------------
ERROR: Failed to generate exception summary:
ActionView::Template::Error: , accepted HTTP methods are OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK, VERSION-CONTROL, REPORT, CHECKOUT, CHECKIN, UNCHECKOUT, MKWORKSPACE, UPDATE, LABEL, MERGE, BASELINE-CONTROL, MKACTIVITY, ORDERPATCH, ACL, SEARCH, and PATCH
We don't need Request
section as long as rake task, right? :)
Thanks for the details. It turns out you were just seeing the symptoms of a different bug. The way I was handling sections wasn't right. I fixed this and pushed a new version of the gem (https://rubygems.org/gems/exception_notification-rake/versions/0.2.1.rc1). Read the updated documentation in the rails4.1 branch (https://github.com/nikhaldi/exception_notification-rake/tree/rails4.1). There is a subtle change in that the :rake? flag is not available anymore in the environment.
I tried the new version and it works fine. Now I understand your implementation (and why the error occurred) correctly. Your fix is more suitable. Thanks :)
It would be better to set both
sections
andbackground_sections
by default. Otherwise, we get error inRequest
section when processing as a normal notification.