How can I write an exception stack trace in erlang after catching it?

前端 未结 3 1235
借酒劲吻你
借酒劲吻你 2021-02-05 09:52

Suppose I have something like this :

try code_that_fails()
catch _:_ -> .....

How do I print the stacktrace in the catch block? That block c

3条回答
  •  醉酒成梦
    2021-02-05 10:36

    An answer for your question is:

    io:format("Backtrace ~p~n", [erlang:get_stacktrace()])
    

    The current function is at the head of the list. Read more in man 3erl erlang or erlang:get_stacktrace/0

提交回复
热议问题