File 2565-qlc-Future-proof-exception-handling-code.patch of Package erlang
From 3681218fc3193693f4a22c818925a2765b5121fb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 10 May 2017 07:25:50 +0200
Subject: [PATCH 3/4] qlc: Future-proof exception handling code
In the future, erlang:get_stacktrace/0 will probably only work
inside a the 'catch' block of a 'try' expression.
Future-proof the code by rewriting the old-style catch to
a try...catch.
---
lib/stdlib/src/qlc.erl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/stdlib/src/qlc.erl b/lib/stdlib/src/qlc.erl
index 20aaa2638..535ca57a6 100644
--- a/lib/stdlib/src/qlc.erl
+++ b/lib/stdlib/src/qlc.erl
@@ -1392,8 +1392,10 @@ next_loop(Pid, L, N) when N =/= 0 ->
{caught, throw, Error, [?THROWN_ERROR | _]} ->
Error;
{caught, Class, Reason, Stacktrace} ->
- _ = (catch erlang:error(foo)),
- erlang:raise(Class, Reason, Stacktrace ++ erlang:get_stacktrace());
+ CurrentStacktrace = try erlang:error(foo)
+ catch error:_ -> erlang:get_stacktrace()
+ end,
+ erlang:raise(Class, Reason, Stacktrace ++ CurrentStacktrace);
error ->
erlang:error({qlc_cursor_pid_no_longer_exists, Pid})
end;
--
2.13.0