Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add middleware or before pipe for sending errors to services (honey badger, new relic, etc.) #500

Closed
paulcsmith opened this issue Jun 8, 2018 · 3 comments

Comments

@paulcsmith
Copy link
Member

paulcsmith commented Jun 8, 2018

Or maybe it would be in Errors::Show?

I'm imagining something like this:

class Errors::Show
  def handle_error(e : Exception)
    record_error(e)
  end

  def record_error(e : Exception)
     # Record on Honeybadger or something else
  end
end

It may be good to have some kind of LuckyErrorNotifier that can take 1 or more adapters. So you could technically send to multiple error backends if desired. Ship with some adapters for common services like Sentry or BugSnag

@paulcsmith paulcsmith added this to the Next milestone Jun 16, 2018
@paulcsmith
Copy link
Member Author

Alternatively, hook into the existing ErrorHandler and configure an error class

@jwoertink
Copy link
Member

jwoertink commented Oct 4, 2018

This one is a little tricky. The next release of Raven will actually include built-in lucky support. And then Bugsnag doesn't really take much but a single line.

Now, what I'm thinking (just a rough draft here) is that this gets added in right below this line to do something like

#...
rescue error : Exception
  send_error_report(context, error) if Lucky::Env.production?
  if settings.show_debug_output
#...

private def send_error_report(context, error)
  Lucky::ExceptionReporter.engines.each do |engine|
    engine.call(context, error)
  end
end

This would be where the engines are just Array(Proc(HTTP::Server::Context, Exception)) and defined in the config somewhere.

Then in the config, the dev would do like

require "my_exception_handler"
MyExceptionHandler.config

Lucky::ExceptionReporter.add_handler << ->(ctx, e) { 
  MyExceptionHandler.report(ctx, e)
}

I would imagine this file would be generated with all projects, and then just have a bunch of comments showing examples of what someone could do. If you like this, I can start working on it.

Edit: I should note that this is sort of how we're currently using them, and reporting has been pretty great. Only downside is handlers that error out before they get here don't get exceptions. No clue how to fix that.

@paulcsmith
Copy link
Member Author

Closing in favor of #868

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants