Comments (7)
This is actually my issue; I accidentally used the wrong account to start this issue.
Looking into this a little farther, I'm noticing that ActiveRecord::RecordNotFound hasn't been defined by the time ExceptionNotifier is loaded. So ActiveRecord::RecordNotFound isn't added to the ignore list.
If I add this to my environment file (like config/environments/development.rb as I'm testing it):
config.middleware.use ExceptionNotifier,
:ignore_exceptions => [ActiveRecord::RecordNotFound]
I get this error:
uninitialized constant ActiveRecord::RecordNotFound (NameError)
So I'd assume that ActiveRecord isn't loaded at this point.
from exception_notification.
can you provide a failing test reproducing this bug? Thanks!
from exception_notification.
Not exactly sure what you're asking for. I'll write everything that I'm doing to use ExceptionNotification.
Ruby 1.9.2
Rails 3.0.5
ExceptionNotification gem 2.5.2
Gemfile:
gem 'exception_notification'
config/environments/development.rb:
SHD::Application.config.middleware.use ExceptionNotifier,
:ignore_exceptions => [ActiveRecord::RecordNotFound]
explicitly call ActiveRecord::RecordNotFound to force it to be loaded.
Now when starting the server, I git this:
Macintosh-4:shd jhoward$ rails server
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Volumes/code/shd/config/environments/development.rb:28:in `<top (required)>': uninitialized constant ActiveRecord::RecordNotFound (NameError)
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/application/bootstrap.rb:11:in `block in <module:Bootstrap>'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `block in run_initializers'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
from /Volumes/code/shd/config/environment.rb:5:in `<top (required)>'
from /Volumes/code/shd/config.ru:3:in `block in <main>'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.4/lib/rack/builder.rb:46:in `instance_eval'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.4/lib/rack/builder.rb:46:in `initialize'
from /Volumes/code/shd/config.ru:1:in `new'
from /Volumes/code/shd/config.ru:1:in `<main>'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.4/lib/rack/builder.rb:35:in `eval'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.4/lib/rack/builder.rb:35:in `parse_file'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.4/lib/rack/server.rb:162:in `app'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.4/lib/rack/server.rb:253:in `wrapped_app'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/rack-1.2.4/lib/rack/server.rb:204:in `start'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands/server.rb:65:in `start'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:30:in `block in <top (required)>'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:27:in `tap'
from /Users/jhoward/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.5/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Please let me know if this isn't what you're looking for.
from exception_notification.
Try placing the SHD::Application.config.middleware.use ExceptionNotifier
lines of configuration on the config.ru
file, as explained in the README, and let me know if this fixes your issue.
from exception_notification.
When removing the ExceptionNotifier lines from the environment file and putting them in the config.ru
so it now looks like this:
require ::File.expand_path('../config/environment', __FILE__)
run SHD::Application
SHD::Application.config.middleware.use ExceptionNotifier,
:ignore_exceptions => [ActiveRecord::RecordNotFound]
The application seems to not even use ExceptionNotification. The server will start up, however, no notifications are made for exceptions. Like if I just create a RuntimeError in a controller by raise "AHHHH"
. (ExceptionNotification does run for this exception if it's configured in the environment file.)
from exception_notification.
If I have the ExceptionNotifier lines of code in the application.rb
file, it responds the same as if it was in the environment file in that the server boot fails with uninitialized constant error.
from exception_notification.
Okay, so this is how I was finally able to fix this. I decided to use an initializer to config ExceptionNotifier. So in config/initializers/exception_notification.rb
, I have this:
if Rails.env.production?
require 'active_record/errors'
SHD::Application.config.middleware.use ExceptionNotifier,
.........config stuff here
end
You can see that I had to require the active_record/errors
file first to insure that ActiveRecord::RecordNotFound
was initialized.
from exception_notification.
Related Issues (20)
- No way to tell which rails environment the error came from
- Error on Rails 6.1 for Rails.application.class.parent_name.underscore HOT 2
- SNS Notifier Data Attribute
- New exception to add to ignored_exceptions HOT 2
- Secret_key_base is leaking through the email HOT 5
- link in the readme IS NOT AVAILABLE HOT 1
- Access to env through `notification_trigger` callback
- Add ability to control how exceptions are grouped for error_grouping HOT 1
- HTTP Authorization Header
- Additional data doesn't show in teams notification HOT 3
- Ignore_notifier_if settings are not respected in non-Rack usages such as background jobs. HOT 1
- Rails 7 is out ! HOT 4
- Psych 4 incompatible HOT 1
- Update rubocop configuration
- Gem's package includes `examples` directory
- Rails 7 API only exception not working HOT 3
- Google Chat is not sending error notification
- Can't find stack trace in the email notification HOT 1
- Error counts for grouped exception notifications are updated inconsistently, causing duplicate alerts
- Add new default exception to ignore for Rack::Utils::InvalidParameterError
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exception_notification.