From 6b7e6449e457628daa8315fac3ff36dcdc4f7cc7 Mon Sep 17 00:00:00 2001 From: Bernard Duggan Date: Wed, 18 Dec 2024 14:38:18 +1100 Subject: [PATCH] fix: Fix function spec for Response.decode/2 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). --- clients/gax/lib/google_api/gax/response.ex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/gax/lib/google_api/gax/response.ex b/clients/gax/lib/google_api/gax/response.ex index b7eb0ba345..17e9657b85 100644 --- a/clients/gax/lib/google_api/gax/response.ex +++ b/clients/gax/lib/google_api/gax/response.ex @@ -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}