Comments (3)
Thanks for the suggestion! Unfortunately I see a few problems with this. Many people have logic in their code which comes after calling notify_honeybadger
, so causing this to re-raise would seriously break some projects in development. Also, it's possible to call this method outside of a rescue block, and re-raising there would cause unexpected exceptions to be raised.
If you want to use this everywhere, I'd either override the notify_honeybadger
, or build your own method which has the modified behavior:
def report_exception(ex)
if Rails.env.development?
raise ex # or logger.error(ex)
else
notify_honeybadger(ex)
end
end
from honeybadger-ruby.
You are right that re-raising the exception might not be such a good idea since the code after that would not be executed in development. But then don't you think it would be at least a good idea to log the error in the console so we know something is happening? Or maybe have a global config to determine what should be the behaviour? Maybe a block of code like you have for the async
config. Right now the only choices are to report or ignore the exception in development.
config.development_notify do |notice|
Rails.logger.error(ex) # The actual behaviour is set by the user in Honeybadger.configure
end
I could also implement a report_exception
as you mention but that would only work in controllers and not my lib and model classes. I guess I would then need another report_exception
method for those and suddenly it gets a bit messy for something that should probably handled directly in the gem!
from honeybadger-ruby.
Hey Pierre, sorry for not replying sooner! I get what you're saying, but I'm still not convinced this is something which belongs in the Honeybadger gem. Honeybadger is providing notification of errors, but it's still up to the user to handle the errors themselves. In your case I recommend creating your own error handling abstraction which will both notify Honeybadger in production and log in development (kind of like the report_exception
method I mentioned earlier).
from honeybadger-ruby.
Related Issues (20)
- Add support for Hanami HOT 1
- `Honeybadger.notify` requires `error_message` to be specified when using a Hash HOT 4
- Documentation and source mismatch with Rails.error.record HOT 1
- `Honeybadger::Config#respond_to?` Always Returns true
- Help suppressing a certain error HOT 4
- Honeybadger CLI errors when the deploy command is called with any option HOT 3
- Minitest: Test Backend Notices Not Added to `Honeybadger::Backend::Test` HOT 9
- Invalid class_name param in documentation HOT 1
- Use nested context from objects where available
- Sidekiq 7.1.5 and later changes number of arguments for error handlers
- Add check-in configuration sync HOT 2
- Automate releases with Github Actions
- Flaky test in JRuby test matrix entry
- Allow check-ins to be made by slug as well as id. HOT 8
- Avoid bundling unnecessary dependencies in published gem HOT 3
- Exceptions raised in jobs from Solid Queue are not automatically reported HOT 10
- Sanitizer#filter_key? returns a warning for Numeric hash keys HOT 5
- ActiveJob premature reporting HOT 2
- ActiveJob rescued exceptions should not be reported HOT 2
- Honeybadger.context returns Honeybadger::Agent when passing a block
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 honeybadger-ruby.