Skip to content

Commit

Permalink
Fix: avoid using Marshal.dump, .load
Browse files Browse the repository at this point in the history
Honeybadger.context does "Local context" on its own, now.

https://docs.honeybadger.io/lib/ruby/getting-started/adding-context-to-errors/

Before, this code had issues around marshaling/unmarshaling that it does
not need to have.
  • Loading branch information
olleolleolle committed Dec 13, 2024
1 parent 704d327 commit 3c63875
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/barsoom_utils/exception_notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,7 @@ def self.message(message, details_or_context = nil, context_or_nothing = nil)

# Wrap this around code to add context when reporting errors.
def self.run_with_context(context, &block)
# The load/dump achieves a "deep dup" without the "deep dep" of Active Support 🥁
old_context = Marshal.load(Marshal.dump(Honeybadger.get_context))

Honeybadger.context(context)
block.call
ensure
Honeybadger.context.clear!
Honeybadger.context(old_context)
Honeybadger.context(context, &block)
end
end
end

1 comment on commit 3c63875

@ximes
Copy link

@ximes ximes commented on 3c63875 Dec 19, 2024

Choose a reason for hiding this comment

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

🚀

Please sign in to comment.