esl / escalus

An XMPP client library in Erlang for conveniently testing XMPP servers
Apache License 2.0
130 stars 76 forks source link

Use modern stacktrace fetching #241

Closed NelsonVides closed 3 years ago

NelsonVides commented 3 years ago

This is a critical issue. Since OTP20, erlang:get_stacktrace/0 is deprecated, and since OTP22, it strictly returns empty lists. This clashes with the implementation of OTP's common_test, which relies on the stacktrace to identify where an error happened. Was any error to be thrown during the execution of a escalus story, the stacktrace list would be empty and then crash here: https://github.com/erlang/otp/blob/864a6303ea8c64ca821a0cc4a1d8fc9d19e6f430/lib/common_test/src/ct_framework.erl#L997 with a case_clause error, because there's no case expecting an empty list, and then the error printed would be a horrendous:

=== Location: unknown
=== === Reason: {'EXIT',
                     {fw_error,
                         {ct_framework,error_notification,
                             {{case_clause,[]},
                              [{ct_framework,error_notification,4,
                                   [{file,"ct_framework.erl"},{line,997}]},
                % ...