Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Returned by Tesla.Adapter.Finch.request/6 is Not Always an Exception #469

Closed
mdsebald opened this issue Jun 10, 2021 · 4 comments
Closed
Labels
finch Issues related to Finch adapter

Comments

@mdsebald
Copy link

I don't know if the problem is here or in Finch, so I'll start here, but feel free to direct me elsewhere.

The :error tuple returned by Finch.request() is not always an Exception, but Finch Adapter request() is expecting {:error, %Exception{}} on an error.

And so I get:

** (FunctionClauseError) no function clause matching in Exception.message/1
    (elixir 1.12.1) lib/exception.ex:58: Exception.message(%{reason: :disconnected})
    (tesla 1.4.1) lib/tesla/adapter/finch.ex:68: Tesla.Adapter.Finch.call/2
    (hardhat 0.2.0) lib/hardhat/trace.ex:71: anonymous fn/3 in Hardhat.Trace.call/3
    (opentelemetry_api 1.0.0-rc.2) src/otel_tracer_noop.erl:70: :otel_tracer_noop.with_span/5
    (tesla 1.4.1) lib/tesla/middleware/fuse.ex:86: Tesla.Middleware.Fuse.run/3
    (tesla 1.4.1) lib/tesla/middleware/retry.ex:88: Tesla.Middleware.Retry.retry/3
    (tesla 1.4.1) lib/tesla/middleware/follow_redirects.ex:46: Tesla.Middleware.FollowRedirects.redirect/3

Relevant Code

@teamon
Copy link
Member

teamon commented Jun 14, 2021

I think we could pass the underlying mint error as is without calling Exception.message/1

@adriankumpf Any thoughts of this?

@teamon teamon added the finch Issues related to Finch adapter label Jun 14, 2021
@adriankumpf
Copy link
Contributor

adriankumpf commented Jun 14, 2021

According to the function spec Finch should always return an Exception. Therefore an issue in the Finch repo might be a good idea.

But in general, I see no reason why we shouldn't pass on the underlying error.

@lukebakken
Copy link

lukebakken commented Jun 22, 2021

Finch 0.8.0 will address this issue - https://github.com/keathley/finch/issues/142. I think this issue (#469) can be closed.

@mdsebald
Copy link
Author

Finch 0.8.0 released. Closing issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
finch Issues related to Finch adapter
Projects
None yet
Development

No branches or pull requests

4 participants