Closed alco closed 10 years ago
Maybe it doesnt work for compile time stacktraces. Do you get relative paths for runtime stacktraces?
I just tried to reproduce this but i could not:
1) test cookies/1 loaded early (Plug.ConnTest)
** (FunctionClauseError) no function clause matching in URI.parse/1
stacktrace:
(elixir) lib/uri.ex:221: URI.parse(:omg)
(plug) lib/plug/adapters/test/conn.ex:8: Plug.Adapters.Test.Conn.conn/4
test/plug/conn_test.exs:304: Plug.ConnTest."test cookies/1 loaded early"/1
Note plug stacktraces (it was recompiled) are still relative. Is this an umbrella project or are you compiling it in a non-conventional way?
@josevalim That looks like a runtime error. Have you tried with an error that occurs at compile, like using access in a guard as in @alco's example?
Ah, good call. @alco is this app open source? Or can you provide a simple way to reproduce it? I would love to take a look... I have also noticed this stacktrace is wrong:
(elixir) /Users/alco/home/projects/wyvern/lib/wyvern/helpers.ex:17: Kernel.access/2
There is definitely no Kernel.access/2
there (and it is not part of elixir).
I'll try narrowing it down to a small code example.
defmodule M do
def something(opts) do
cond do
opts[:tag]=tag -> :ok
end
end
end
λ elixirc absolute_paths.ex
== Compilation error on file absolute_paths.ex ==
** (ArgumentError) dynamic access cannot be invoked inside match and guard clauses
(elixir) lib/kernel.ex:2658: Kernel."MACRO-access"/3
(elixir) /Users/alco/home/projects/wyvern/absolute_paths.ex:4: Kernel.access/2
/Users/alco/home/projects/wyvern/absolute_paths.ex:4: M.something/1
(elixir) /Users/alco/home/projects/wyvern/absolute_paths.ex:4: Kernel.!/1
/Users/alco/home/projects/wyvern/absolute_paths.ex:4: M.something/1
(elixir) /Users/alco/home/projects/wyvern/absolute_paths.ex:3: Kernel.cond/1
/Users/alco/home/projects/wyvern/absolute_paths.ex:3: M.something/1
That is beautiful. Thanks!
What about this stacktrace?
== Compilation error on file lib/sample.ex ==
** (ArgumentError) dynamic access cannot be invoked inside match and guard clauses
(elixir) expanding macro: Kernel.access/2
lib/sample.ex:12: Sample.something/1
(elixir) expanding macro: Kernel.!/1
lib/sample.ex:12: Sample.something/1
(elixir) expanding macro: Kernel.cond/1
lib/sample.ex:11: Sample.something/1
:+1:
Isn't Elixir supposed to output relative paths? I thought it did so before 0.13.1.
Elixir version https://github.com/elixir-lang/elixir/commit/e343f210f605330ac2bafe6874e58bb7b60613bd.