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

Fix dialyzer reporting unmatched_return for Sentry.PlugCapture #436

Merged

Conversation

lowang
Copy link
Contributor

@lowang lowang commented Oct 2, 2020

Hello

I've got a project with stricter dialyzer settings:

dialyzer: [
        ...
        flags: [
          :error_handling,
          :race_conditions,
          :underspecs,
          :unmatched_returns
        ]
      ],

and for Phoenix Endpoint module I've got warning:

lib/app_web/endpoint.ex:1:unmatched_return
The expression produces a value of type:

  :excluded
  | :ignored
  | :unsampled
  | {:error, :invalid_dsn | {:invalid_json, _}}
  | {:ok, <<>> | %Task{:owner => pid(), :pid => nil | pid(), :ref => reference()}}

but this value is unmatched.

I cannot silence use Sentry.PlugCapture for dialyzer the usual way with _ =, only dialyzer.ignore-warnings can shut it.
That happens because Sentry.capture_exception is returning multiple values.

Would you accept fix like that?
Another approach would be to have capture_exception function that returns just single atom but I'm not sure what would be a right name for it.

That happens because Sentry.capture_exception is returning multiple values.
@mitchellhenke
Copy link
Contributor

Thanks for the pull request!

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