Skip to content

Instantly share code, notes, and snippets.

@fenollp
Created August 23, 2017 21:04
Show Gist options
  • Save fenollp/a362f1dfa94f2033700ba20d092c8588 to your computer and use it in GitHub Desktop.
Save fenollp/a362f1dfa94f2033700ba20d092c8588 to your computer and use it in GitHub Desktop.
Test printing ST with -Wall & OTP20
%% Copyright © 2017 Pierre Fenoll ‹[email protected]
%% See LICENSE for licensing information.
%% -*- coding: utf-8 -*-
%% @module Test printing ST with -Wall & OTP20
-module(pp_stack_inside_try_catch).
-export([m/1]).
%% API
m(Arg) ->
try Arg + 1 of
1 ->
catch throw(lol),
print_ST(); %%non-empty ST
_ ->
%% empty ST
print_ST()
catch _:_ ->
%% non-empty ST
print_ST()
end.
%% Internals
print_ST() ->
ST = erlang:get_stacktrace(),
io:format(">>> ST ~p\n", [ST]).
%% End of Module.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment