ngw
Hi, I’m using Tesla for a fun project, and I noticed it “explodes” instead of, for example, returning an {:error, something} tuple in case something goes wrong.
iex(2)> Tesla.get("http://foobar.baz")
** (Tesla.Error) adapter error: :econnrefused
lib/tesla/middleware/core.ex:10: Tesla.Middleware.Normalize.normalize/1
How to handle this? Should I use a try block? What if the Tesla call is inside an Enum.map over many urls? Is there an idiomatic way to handle this?
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
OvermindDL1
Try is basically what you would need for this unless it exposes another API (if
getthrows it really should beget!, bleh…NobbZ
The documentation doesn’t even mention to throw or raise, and as far as I was able to scan the docs, there is no tupled version of the functions available.
In my opinion the API should be reworked drastically! Catching is expensive, and not everyone wants to just crash…
ngw
Yeah I guess it’s a bit odd, might be the case to switch to another more “educate” library like HTTPipe, because honestly it doesn’t seem such an incredible occurrence to try to GET a url that doesn’t exist for an HTTP library
vmoravec
Before switching to any other library I would recommend to raise an issue on Tesla github repo and ask the maintainer of the library for improvement or for reasoning why it was designed that way: GitHub - elixir-tesla/tesla: The flexible HTTP client library for Elixir, with support for middleware and multiple adapters. · GitHub
teamon
This has been brought up in the past and just now - please take a look at More conventional output · Issue #64 · elixir-tesla/tesla · GitHub and Return error tuple instead of raising errors by gdub01 · Pull Request #81 · elixir-tesla/tesla · GitHub
As you can see, it is very easy to change this behaviour to whatever suits you best - tesla was designed to be extensible as much as possible. I’m happy to continue the discussion in tesla’ github issues.
I should’ve probably ignore this, but as a active member of elixir community I feel obligated to do my best to make it a nice and helpful place for everyone and stand up to undesired behaviour.
I know having issues with 3rd party libraries can be frustrating. But please remember that most of the time these libraries are made by people for free, with their own free time. Pointing that something “should” be done this way or another is not a good way to start a discussion. Not to mention the rest of pointless, ranting comments here. This is the perfect example of making a hostile community.
Thank you @vmoravec for a reasonable approach to this issue. That’s how we can get nice things.