Browse Source

Replace erlang:get_stacktrace() with catch C:E (V=0) or C:E:S (V>0)

This makes us compatible with OTP < 21, except when V (verbose) is set.
Viktor Söderqvist 4 years ago
parent
commit
b7d8105ef0
3 changed files with 6 additions and 6 deletions
  1. 2 2
      plugins/asciidoc.mk
  2. 2 2
      plugins/proper.mk
  3. 2 2
      plugins/triq.mk

+ 2 - 2
plugins/asciidoc.mk

@@ -57,8 +57,8 @@ try
 		})
 	end || F <- [$(shell echo $(addprefix $(comma)\",$(addsuffix \",$1)) | sed 's/^.//')]],
 	halt(0)
-catch C:E ->
-	io:format("Exception ~p:~p~nStacktrace: ~p~n", [C, E, erlang:get_stacktrace()]),
+catch C:E$(if $V,:S) ->
+	io:format("Exception: ~p:~p~n$(if $V,Stacktrace: ~p~n)", [C, E$(if $V,$(comma) S)]),
 	halt(1)
 end.
 endef

+ 2 - 2
plugins/proper.mk

@@ -37,8 +37,8 @@ define proper_check.erl
 	end of
 		true -> halt(0);
 		_ -> halt(1)
-	catch error:undef ->
-		io:format("Undefined property or module?~n~p~n", [erlang:get_stacktrace()]),
+	catch error:undef$(if $V,:Stacktrace) ->
+		io:format("Undefined property or module?~n$(if $V,~p~n)", [$(if $V,Stacktrace)]),
 		halt(0)
 	end.
 endef

+ 2 - 2
plugins/triq.mk

@@ -26,8 +26,8 @@ define triq_check.erl
 	end of
 		true -> halt(0);
 		_ -> halt(1)
-	catch error:undef ->
-		io:format("Undefined property or module?~n~p~n", [erlang:get_stacktrace()]),
+	catch error:undef$(if $V,:Stacktrace) ->
+		io:format("Undefined property or module?~n$(if $V,~p~n)", [$(if $V,Stacktrace)]),
 		halt(0)
 	end.
 endef