From 7e078b070b3acf6c0b24d66a150b09a7df57b09d Mon Sep 17 00:00:00 2001 From: Emilio Jesus Gallego Arias Date: Tue, 11 Feb 2020 11:33:55 +0100 Subject: [misc] Better preserve backtraces in several modules Re-raising inside exception handlers must be done with care in order to preserve backtraces; even if newer OCaml versions do a better job in automatically spilling `%reraise` in places that matter, there is no guarantee for that to happen. I've done a best-effort pass of places that were re-raising incorrectly, hopefully I got the logic right. There is the special case of `Nametab.error_global_not_found` which is raised many times in response to a `Not_found` error; IMHO this error should be converted to something more specific, however the scope of that change would be huge as to do easily... --- user-contrib/Ltac2/tac2core.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'user-contrib') diff --git a/user-contrib/Ltac2/tac2core.ml b/user-contrib/Ltac2/tac2core.ml index e77040a8db..0299da6a25 100644 --- a/user-contrib/Ltac2/tac2core.ml +++ b/user-contrib/Ltac2/tac2core.ml @@ -1162,8 +1162,9 @@ let () = | Tac2qexpr.QReference qid -> let gr = try Nametab.locate qid - with Not_found -> - Nametab.error_global_not_found qid + with Not_found as exn -> + let _, info = Exninfo.capture exn in + Nametab.error_global_not_found ~info qid in GlbVal gr, gtypref t_reference in -- cgit v1.2.3