Skip to content

Commit f56847a

Browse files
committed
rabbit_feature_flags: Make it compatible with Erlang 20.x
1 parent 53da7ec commit f56847a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/rabbit_feature_flags.erl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@
8686

8787
-module(rabbit_feature_flags).
8888

89+
%% Transitional step until we can require Erlang/OTP 21 and
90+
%% use the now recommended try/catch syntax for obtaining the stack trace.
91+
-compile(nowarn_deprecated_function).
92+
8993
-export([list/0,
9094
list/1,
9195
list/2,
@@ -955,7 +959,8 @@ module_attributes_from_testsuite() ->
955959
try
956960
throw(force_exception)
957961
catch
958-
throw:force_exception:Stacktrace ->
962+
throw:force_exception ->
963+
Stacktrace = erlang:get_stacktrace(),
959964
Modules = lists:filter(
960965
fun({Mod, _, _, _}) ->
961966
ModS = atom_to_list(Mod),
@@ -1485,7 +1490,8 @@ run_migration_fun(FeatureName, FeatureProps, Arg) ->
14851490
MigrationFun,
14861491
[FeatureName, FeatureProps, Arg])
14871492
catch
1488-
_:Reason:Stacktrace ->
1493+
_:Reason ->
1494+
Stacktrace = erlang:get_stacktrace(),
14891495
rabbit_log:error("Feature flag `~s`: migration function "
14901496
"crashed: ~p~n~p",
14911497
[FeatureName, Reason, Stacktrace]),

0 commit comments

Comments
 (0)