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

feat: return block value if block was passed to Honeybadger.context #546

Merged
merged 1 commit into from
May 10, 2024

Conversation

d4rky-pl
Copy link
Contributor

This PR improves on the local contexts feature introduced in #541 by making Honeybadger.context return the result of the block instead of the Agent instance when local contexts are used.

This allows seamless wrapping of existing application code:

class SuperImportantPaymentProcessing
  def call
    Honeybadger.context({ tags: ['critical', 'payments'] }) do
      # bunch of things happening
      { success: true, charge: }
    rescue PaymentError => e
      Honeybadger.notify(e) # this still gets tagged!
      { success: false }
    end
  end
end

@stympy stympy linked an issue May 10, 2024 that may be closed by this pull request
Copy link
Member

@stympy stympy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@stympy stympy merged commit 2d7c685 into honeybadger-io:master May 10, 2024
41 checks passed
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

Successfully merging this pull request may close these issues.

Honeybadger.context returns Honeybadger::Agent when passing a block
2 participants