honeybadger-elixir
honeybadger-elixir copied to clipboard
Is this documentation outdated?
The README and code docs for Honeybadger.notify
say to pass the context as the second argument:
https://github.com/honeybadger-io/honeybadger-elixir/blob/d051f0754dd44e13c9cc7c989d7fdfc5cb068f82/lib/honeybadger.ex#L44
...but it looks like the second argument is actually metadata, which expects a context
key:
https://github.com/honeybadger-io/honeybadger-elixir/blob/c2dc31100fb764ad4b0c4df6bf94bdef0bbc8984/lib/honeybadger/notice.ex#L58
Should it be Honeybadger.notify(exception, context)
, or Honeybadger.notify(exception, %{context: context})
? I may be forgetting how this works.
cc @rabidpraxis @sorentwo
@joshuap The second argument is the metadata and not the context. To pass in context you need the %{context: context}
map.
@joshuap Notice.new
expects a map with :context
, but it looks like Honeybadger.notify
will jam all metadata the into the context key if its not already present:
https://github.com/honeybadger-io/honeybadger-elixir/blob/24edb30cb2a2c9462bdc453c9943fa64ef9bac00/lib/honeybadger.ex#L253-L257
https://github.com/honeybadger-io/honeybadger-elixir/blob/24edb30cb2a2c9462bdc453c9943fa64ef9bac00/lib/honeybadger.ex#L428-L435
@rabidpraxis oh OK, so our docs are actually valid? Is there a method you prefer?
I'm not sure. I probably swing towards favoring the explicit version, just for readability sake.