Skip to content

Commit d9d3377

Browse files
committed
Remove Erlang old catch for future compatibility.
1 parent e748da0 commit d9d3377

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2009-2023 Michael Truog <mjtruog at protonmail dot com>
3+
Copyright (c) 2009-2025 Michael Truog <mjtruog at protonmail dot com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a
66
copy of this software and associated documentation files (the "Software"),

src/cloudi_service_http_cowboy1.erl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
%%%
1010
%%% MIT License
1111
%%%
12-
%%% Copyright (c) 2012-2021 Michael Truog <mjtruog at protonmail dot com>
12+
%%% Copyright (c) 2012-2025 Michael Truog <mjtruog at protonmail dot com>
1313
%%%
1414
%%% Permission is hereby granted, free of charge, to any person obtaining a
1515
%%% copy of this software and associated documentation files (the "Software"),
@@ -30,8 +30,8 @@
3030
%%% DEALINGS IN THE SOFTWARE.
3131
%%%
3232
%%% @author Michael Truog <mjtruog at protonmail dot com>
33-
%%% @copyright 2012-2021 Michael Truog
34-
%%% @version 2.0.2 {@date} {@time}
33+
%%% @copyright 2012-2025 Michael Truog
34+
%%% @version 2.0.8 {@date} {@time}
3535
%%%------------------------------------------------------------------------
3636

3737
-module(cloudi_service_http_cowboy1).
@@ -203,6 +203,10 @@
203203
-endif.
204204
-endif.
205205

206+
% avoid misuse of old catch with a macro
207+
-define(CATCH(E),
208+
try E, ok catch _:_ -> ok end).
209+
206210
%%%------------------------------------------------------------------------
207211
%%% External interface functions
208212
%%%------------------------------------------------------------------------
@@ -602,7 +606,7 @@ cloudi_service_terminate(_Reason, _Timeout, undefined) ->
602606
ok;
603607
cloudi_service_terminate(_Reason, _Timeout,
604608
#state{service = Service}) ->
605-
_ = (catch cowboy:stop_listener(Service)),
609+
ok = ?CATCH(cowboy:stop_listener(Service)),
606610
ok.
607611

608612
%%%------------------------------------------------------------------------

0 commit comments

Comments
 (0)