Discussion of __STACKTRACE__:
- NobbZ: You should not rely on the ability to get the stacktrace outside of a
rescue/catch, it might get removed from the BEAM with any major release. - OvermindDL1: A workaround is just to throw an exception and then immediately catch it of course, which can be wrapped up in a function.
- josevalim: If you want to get the current stacktrace, then you should do
Process.info(self(), :current_stacktrace).
It should be noted:
i.e. try ... catch defeats last call optimization.




















