Skip to content

Instantly share code, notes, and snippets.

@tijmenb
Created September 20, 2017 10:58
Show Gist options
  • Save tijmenb/74b4bd02d8332cf58d82b1f71458a111 to your computer and use it in GitHub Desktop.
Save tijmenb/74b4bd02d8332cf58d82b1f71458a111 to your computer and use it in GitHub Desktop.
# In the app we re-raise every error, with a reference to the original
class HardWorker
def perform
# blabla
rescue GdsApi::TimeOut => e
raise GovukSidekiq::RetryableError.new(cause: e)
end
end
# In govuk_app_config we ignore all retryable errors
Raven.configure do |config|
config.excluded_exceptions << "GovukSidekiq::RetryableError"
end
# And in govuk_sidekiq we make sure that we raise the original error
sidekiq_retries_exhausted do |msg, e|
if e.is_a?(GovukSidekiq::RetryableError)
raise e.cause
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment