socketry / async

An awesome asynchronous event-driven reactor for Ruby.
MIT License
2.04k stars 85 forks source link

Catch all Async errors and report to Sentry? (or other error reporting) #287

Closed chrisjingram closed 8 months ago

chrisjingram commented 8 months ago

Hey,

If I have some tasks such as:

Async { PostToSlack.message("hello world") }

If these fail, I'm not finding out through my error reporting, Sentry.

How can I catch all errors in Async tasks to report them to Sentry?

For example, in Rails I do something like:

  rescue_from StandardError, with: :show_error

  def show_error(exception)
    Sentry.capture_exception(exception)
  end