How to quickly debug a phoenix / elixir?

As I study Elixir / Phoenix, I often encounter such a problem.

The problem is that this is due to dependency, so usually I do this:

  • open deps/something/.../thefile.ex
  • add a debug code, for example IO.inspect, to find out which parameters are passed
  • stop the server, recompile with mix deps.recompile something
  • check the documentation to see what types are expected of this function.
  • compare types and trace the problem to my code

This works, but I would like to improve my process, I know that I can use Iex to start the replica, but I would like to get much faster in terms of:

  • in which the inside of the error page itself starts automatically (for example, in the best_errors gem for Rails)
  • to find out what arguments went into this method, without my digging (can be solved by the first point)
  • the ability to quickly view documentation by the method

Any other tips are also welcome.

enter image description here

+4
source share
1 answer

Please open the problem in Plug: https://github.com/elixir-lang/plug

You have some great suggestions, such as accessing documents and explicitly defining arguments. I do not think we can provide REPL in place of error.

EDIT 1: I went ahead and discovered the problem here since I was delighted with these improvements !: D

2: , , , , (!)

+8

Source: https://habr.com/ru/post/1677608/


All Articles