diff --git a/lib/hunter/api/http_client.ex b/lib/hunter/api/http_client.ex index e9b7cbe..9f6a72d 100644 --- a/lib/hunter/api/http_client.ex +++ b/lib/hunter/api/http_client.ex @@ -341,9 +341,10 @@ defmodule Hunter.Api.HTTPClient do defp request!(url, to, method, payload, conn \\ nil) do headers = get_headers(conn) - with {:ok, body} <- Request.request(method, url, payload, headers, Config.http_options()) do - transform(body, to) - else + case Request.request(method, url, payload, headers, Config.http_options()) do + {:ok, body} -> + transform(body, to) + {:error, reason} -> raise Hunter.Error, reason: reason end