Skip to content

Commit 5f3480d

Browse files
authored
Merge pull request #83 from mikpe/remove-deprecated-format_status-2-otp27
aws_credentials: replace deprecated format_status/2 with format_status/1
2 parents f3b1413 + 63394d2 commit 5f3480d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/aws_credentials.erl

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222
, handle_call/3
2323
, handle_cast/2
2424
, handle_info/2
25-
, format_status/2
25+
, format_status/1
2626
]).
2727

28+
-if(?OTP_RELEASE < 27).
29+
-export([format_status/2]).
30+
-endif.
31+
2832
-export([ start_link/0
2933
, stop/0
3034
, get_credentials/0
@@ -162,9 +166,18 @@ handle_info(Message, State) ->
162166
code_change(_Prev, State, _Extra) ->
163167
{ok, State}.
164168

169+
-spec format_status(gen_server:format_status()) -> gen_server:format_status().
170+
format_status(#{reason := _Reason, state := State} = Status) ->
171+
Status#{state => State#state{credentials = information_redacted}};
172+
format_status(Status) ->
173+
Status.
174+
175+
-if(?OTP_RELEASE < 27).
176+
%% TODO: remove once OTP-25 is the oldest supported OTP version
165177
-spec format_status('normal' | 'terminate', any()) -> any().
166178
format_status(_, [_PDict, State]) ->
167179
[{data, [{"State", State#state{credentials=information_redacted}}]}].
180+
-endif.
168181

169182
%%====================================================================
170183
%% Internal functions

0 commit comments

Comments
 (0)