Skip to content

Conversation

potatosalad
Copy link
Contributor

The stacktrace for certain errors (like FunctionClauseError) may resolve incorrectly inside Sentry.Event.transform_exception/2 due in part to the issue described in elixir-lang/elixir#7622.

To reproduce the issue, the following can be run to force a FunctionClauseError error report generated by a supervisor:

:error_logger.add_report_handler(Sentry.Logger)
{:ok, pid} = Task.Supervisor.start_link()
Task.Supervisor.start_child(pid, fn -> :lists.last([]) end)

In the generated event, the message will show:

(FunctionClauseError) no function clause matching in Keyword.delete_key/3

Instead of reporting as expected:

(FunctionClauseError) no function clause matching in :lists.last/1

@potatosalad potatosalad changed the title Use the stacktrace passed to Sentry.Event.transform_exception/2 when calling Exception.normalize/3 Use the stacktrace passed to Sentry.Event.transform_exception/2 when calling Exception.normalize/3 Apr 29, 2018
@potatosalad
Copy link
Contributor Author

It also appears that Exception.normalize/2 itself may be deprecated soon, which means that transforming an exception without a stacktrace may not be possible in the future: elixir-lang/elixir#7628

@mitchellhenke
Copy link
Contributor

@potatosalad thank you so much for the detailed explanation and pull request! 💖 ❤️ 💜 💙

@mitchellhenke mitchellhenke merged commit 15fe965 into getsentry:master May 3, 2018
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