Skip to content

Commit 9126f3d

Browse files
committed
use OTP_RELEASE macro (OTP 21+). ref #70
1 parent cf443be commit 9126f3d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/jesse_tests_util.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
-define(TESTS, <<"tests">>).
3636
-define(VALID, <<"valid">>).
3737

38+
-ifdef(OTP_RELEASE). %% OTP 21+
39+
-define(EXCEPTION(C, R, Stacktrace), C:R:Stacktrace ->).
40+
-else.
41+
-define(EXCEPTION(C, R, Stacktrace), C:R -> Stacktrace = erlang:get_stacktrace(),).
42+
-endif.
43+
3844
%%% API
3945

4046
get_tests(RelativeTestsDir, DefaultSchema) ->
@@ -90,10 +96,10 @@ test_schema(DefaultSchema, Opts0, Schema, SchemaTests) ->
9096
false ->
9197
{error, _} = Result
9298
end
93-
catch C:E ->
99+
catch ?EXCEPTION(C,R,Stacktrace)
94100
ct:pal( "Error: ~p:~p~n"
95101
"Stacktrace: ~p~n"
96-
, [C, E, erlang:get_stacktrace()]
102+
, [C, R, Stacktrace]
97103
)
98104
end
99105
end

0 commit comments

Comments
 (0)