mike_bianco

mike_bianco

Help an Elixir beginner find missing development tooling!

Hello! I’ve been super impressed with the community here on the forum. Thanks for the help everyone has provided thus far!

I just finished my first side project in Elixir and there are a couple of things I’m missing from ruby-land, and some minor annoyances I’ve run into. I’m guessing there are extensions or tweaks I can make to eliminate most of these. I’d appreciate any insight—thank you!

Here’s the list of questions & missing tooling I’ve run into:

  1. Automatically open up a REPL when an exception is thrown. In ruby, this is done via pry-rescue. Super helpful for quickly diving into the exact context where the error occurs.
  2. In Phoenix, it would be amazing if the debugging plug (which displays a page when an exception is thrown) displays the variables bound in a specific scope so I can reproduce & fix errors quickly. (It would be even better if a REPL could be opened and interacted with on the exception page. better-errors does this in ruby.)
  3. iex -S mix phx.server feels weird. It would feel a bit nicer if there was a mix phx.console which setup IEx for you.
  4. Allow? [Yn] is really annoying when I’m debugging a piece of code. It would be great if you could auto-accept require IEx; IEx.pry requests.
  5. In a debugging session, I couldn’t figure out how to navigate up and down the call stack. Is there something like pry-nav available?
  6. Scan dependencies for security issues. In ruby, this is done via bundler-audit.
  7. I couldn’t find a VS Code extension with phoenix* snippets. Is there a way to autogenerate snippets automatically from installed hex packages?

Most Liked

joaquinalcerro

joaquinalcerro

Cool.

Take a look at this presentation where Luke explains some debugging techniques:

It helped me hope it does the same for you.

OvermindDL1

OvermindDL1

Huh?

iex(1)> a = 42
42
iex(2)> try do 
...(2)>   throw :ack
...(2)> catch v ->
...(2)>   b = 6.28
...(2)>   IO.inspect(binding(), label: :Bindings)
...(2)> end
Bindings: [a: 42, b: 6.28, v: :ack]
[a: 42, b: 6.28, v: :ack]

If a binding ‘can’ be used in the local scope, then binding() will show it, it just compiles to a keyword list of bindings names to the bindings themselves, like [a: a, b: b, v: v]. Is there a case where it will not show a binding that ‘can’ in fact be accessed in the local scope?!

hauleth

hauleth

Not possible as in most cases the failed process do not exist (unhandled exceptions will kill current process), so there is no “context” you can attach to.

As well I doubt that it would be possible, as Erlang do not provide anything like Kernel#local_variables in Ruby. Also as it was said earlier - process is probably dead when the error handling take place, so there is no “context”. Oh, and by the way, as Elixir compiles to Erlang code, and Erlang allows only one assignment per variable name (SSA-like) the “Elixir variables” will have non-meaningful names in Erlang code.

There was mix console but it was removed. I do not know what was the rationale. But if you do not like it, then you can always create custom command or alias (within Mix) or shell alias.

There is Sobelow, but I do not know if this audit the dependencies. For tool that checks deps for security issues we would need centralised log of such issues, AFAIK there is none, and AFAIK Elixir didn’t had any CVE assigned yet.

How would that even work? Really, I cannot imagine.

Where Next?

Popular in Questions Top

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
tduccuong
Hi, is there any work on GUI with Elixir, that is similar to Electron/Javascript? My idea is to bundle Phoenix and BEAM into a single se...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <%= ...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New

Other popular topics Top

9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 47930 226
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement