Skip to content

Conversation

martosaur
Copy link
Contributor

STR:

  1. In a configured project, issue a log with structured message: Logger.error(foo: "bar")
  2. Check message didn't get to Sentry

Here's my attempt on fixing this. Looks like the case statement is trying to work on both report and msg. Also added a basic test as I don't believe there are any for {:report, report} clause.

Comment on lines -349 to -354
%{report: %{reason: {reason, stacktrace}}} when is_list(stacktrace) ->
sentry_opts = Keyword.put(sentry_opts, :stacktrace, stacktrace)
capture(:message, "** (stop) " <> Exception.format_exit(reason), sentry_opts, config)

%{report: report_info} ->
capture(:message, inspect(report_info), sentry_opts, config)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We were never hitting these clauses? Did mix coveralls.html confirm that? 😮

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think so? I mean, the whole function head can be deleted and tests still pass...
CleanShot 2024-08-07 at 08 57 11

Copy link
Collaborator

Choose a reason for hiding this comment

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

Uh, interesting. Well, not good 😄 I suspect that maybe some of those were for older Erlang versions but your change passes on all supported Erlang/Elixir versions, so we're good to go!

@whatyouhide whatyouhide merged commit dda0256 into getsentry:master Aug 8, 2024
@martosaur martosaur deleted the am/structured_messages_in_handler branch August 8, 2024 15:53
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.

2 participants