ex-aws / ex_aws

A flexible, easy to use set of clients AWS APIs for Elixir

Home Page:https://hex.pm/packages/ex_aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unhandled error case from do_request

maciejgryka opened this issue · comments

Environment

  • Elixir & Erlang versions: Elixir 1.15.2 (compiled with Erlang/OTP 25)
  • ExAws version: ex_aws 2.4.3, ex_aws_s3 2.4.0
  • HTTP client version: hackney 1.18.1 (Hex package) (rebar3)

Current behavior

We occasionally get CaseClauseError no case clause matching: {:error, [reason: :closed]} reported with the following stack trace:

lib/ex_aws/request.ex in ExAws.Request.request_and_retry/7 at line 38
lib/ex_aws/operation/s3.ex in ExAws.Operation.ExAws.Operation.S3.perform/2 at line 40

This happens when calling put_object_copy operation and, as far as I can tell, is caused by do_request returning {:error, [reason: :closed]} instead of {:error, %{reason: reason}} which is consequently not caught by the error clause.

Expected behavior

This error response should be caught by one of the case clauses and processed in the same way as {:error, %{reason: reason}}, i.e. by logging and calling request_and_retry.