Giter Club home page Giter Club logo

Comments (3)

joshuap avatar joshuap commented on July 4, 2024

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.

pomartel avatar pomartel commented on July 4, 2024

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.

joshuap avatar joshuap commented on July 4, 2024

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)

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.