elixir-koans
elixir-koans copied to clipboard
Remove stacktrace warning
Using STACKTRACE is not really an option due to it requiring a try/catch block, which we'd have to possibly add to every koan.
Side-step the issue by calling into Erlang
FWIW, this is not going to work on recent OTP versions. Erlang/OTP 23 always returns an empty list for stacktrace and the next version will fully remove the function.
@josevalim @iamvery My current thinking is that we can avoid going through the stacktrace to find file & line if we just capture them in the generated koan function using __ENV__.file and __ENV__.line in the first place.
I'll try a PR this evening and update this :)
I'm quite happy with this new approach.
If an error happens within a Koan, I grab __ENV__.line and __ENV__.file and report it back up as part of the error. That way, there is no need to walk the stacktrace anymore!