Skip to content

Commit

Permalink
Update Finch 0.20 support
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmach committed Nov 25, 2024
1 parent b416fe7 commit 1a72885
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions lib/req/finch.ex
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,12 @@ defmodule Req.Finch do
{:ok, acc} ->
acc

{:error, %Mint.TransportError{reason: reason}} ->
{req, %Req.TransportError{reason: reason}}

{:error, %Mint.HTTPError{module: Mint.HTTP1, reason: reason}} ->
{req, %Req.HTTPError{protocol: :http1, reason: reason}}

{:error, %Mint.HTTPError{module: Mint.HTTP2, reason: reason}} ->
{req, %Req.HTTPError{protocol: :http2, reason: reason}}

{:error, %Finch.Error{reason: reason}} ->
{req, %Req.HTTPError{protocol: :http2, reason: reason}}

# TODO: remove when we require Finch 0.20
{:error, exception} ->
{req, exception}
{req, normalize_error(exception)}

{:error, exception, _acc} ->
{req, normalize_error(exception)}
end
end

Expand Down Expand Up @@ -169,6 +161,9 @@ defmodule Req.Finch do
{:error, exception} ->
{req, normalize_error(exception)}

{:error, exception, {nil, _req, _resp}} ->
{req, normalize_error(exception)}

{:error, exception, {{acc, collector}, _req, _resp}} ->
collector.(acc, :halt)
{req, normalize_error(exception)}
Expand Down

0 comments on commit 1a72885

Please sign in to comment.