File 8924-sofs-Eliminate-old-style-catches.patch of Package erlang
From e4a5d16b162e5b9237f5043ccd76d56877b29a97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Sat, 11 Jan 2025 09:44:55 +0100
Subject: [PATCH 4/7] sofs: Eliminate old-style catches
---
lib/stdlib/src/sofs.erl | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/lib/stdlib/src/sofs.erl b/lib/stdlib/src/sofs.erl
index f214b5643e..4b92bc157f 100644
--- a/lib/stdlib/src/sofs.erl
+++ b/lib/stdlib/src/sofs.erl
@@ -2920,13 +2918,14 @@ family_to_digraph(F, Type) when ?IS_SET(F) ->
_Else -> erlang:error(badarg)
end,
try digraph:new(Type) of
- G -> case catch fam2digraph(F, G) of
- {error, Reason} ->
- true = digraph:delete(G),
- erlang:error(Reason);
- _ ->
- G
- end
+ G ->
+ try
+ fam2digraph(F, G)
+ catch
+ throw:{error, Reason} ->
+ true = digraph:delete(G),
+ erlang:error(Reason)
+ end
catch
error:badarg -> erlang:error(badarg)
end.
@@ -4208,7 +4207,12 @@ types([S | Ss], L) ->
%% Inlined.
unify_types(T, T) -> T;
unify_types(Type1, Type2) ->
- catch unify_types1(Type1, Type2).
+ try
+ unify_types1(Type1, Type2)
+ catch
+ throw:Val ->
+ Val
+ end.
unify_types1(Atom, Atom) when ?IS_ATOM_TYPE(Atom) ->
Atom;
--
2.51.0