Skip to content

Commit

Permalink
fix: Fix function spec for Response.decode/2
Browse files Browse the repository at this point in the history
The input type for `GoogleApi.Gax.Response.decode/2` was missing the error
case (which is explicitly handled in the first function clause).
The return type incorrectly specifies that the error type must be a
`Tesla.Env.t()` when in fact it may return any type (for example `:timeout`
is returned when the Mint HTTP client times out).
  • Loading branch information
bernardd committed Dec 18, 2024
1 parent 079a3c8 commit 6b7e644
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clients/gax/lib/google_api/gax/response.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ defmodule GoogleApi.Gax.Response do
## Returns
* `{:ok, struct()}` on success
* `{:error, Tesla.Env.t}` on failure
* `{:error, any()}` on failure
"""
@spec decode({:ok, Tesla.Env.t()}, keyword()) :: {:ok, struct()} | {:error, Tesla.Env.t()}
@spec decode({:ok, Tesla.Env.t()} | {:error, any()}, keyword()) :: {:ok, struct()} | {:error, any()}
def decode(env, opts \\ [])

def decode({:error, reason}, _), do: {:error, reason}
Expand Down

0 comments on commit 6b7e644

Please sign in to comment.