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(gax): invalid spec in Connection/Response modules #11342

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davidjulien
Copy link

Hello 👋

Specs in connection.ex and response.ex are not correct. It may trigger invalid dialyzer warnings in apps, which may lead to remove necessary code.

For example, for this piece of code:

case Client.indexing_url_notifications_publish( connection, [ {:body, payload} ]) do
  {:ok, _} -> :ok
  {:error, %{status: 429}} -> {:discard, "Rate-limiting error, please check the quota."}
  {:error, :timeout} -> ...
end

For the clause {:error, :timeout}, dialyzer says The pattern can never match the type. However, it is possible to have {:error, :timeout} when Connection fails (because of a timeout).

You can verify with this doc: https://hexdocs.pm/tesla/Tesla.html#request/2

@davidjulien davidjulien requested a review from a team as a code owner April 26, 2024 12:17
Copy link

google-cla bot commented Apr 26, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@davidjulien davidjulien force-pushed the fix-invalid-spec-in-gax-http-calls branch from 7dab44a to 054b519 Compare June 10, 2024 14:17
@davidjulien
Copy link
Author

Is something missing to review this PR?

@davidjulien davidjulien force-pushed the fix-invalid-spec-in-gax-http-calls branch from 054b519 to 3356510 Compare September 26, 2024 08:09
It may trigger invalid dialyzer warnings in apps.

For example, for this piece of code:

```elixir
case Client.indexing_url_notifications_publish( connection, [ {:body, payload} ]) do
  {:ok, _} -> :ok
  {:error, %{status: 429}} -> {:discard, "Rate-limiting error, please check the quota."}
  {:error, :timeout} -> ...
end
```

For the clause `{:error, :timeout}`, dialyzer says `The pattern can never match the type`.
However, it is possible to have `{:error, :timeout}` when Connection fails (because of a timeout).
@davidjulien davidjulien force-pushed the fix-invalid-spec-in-gax-http-calls branch from 3356510 to 49105bb Compare October 1, 2024 08:43
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.

1 participant