From bff6fbb04edf389f28d9c741ed3b36eb9bf60913 Mon Sep 17 00:00:00 2001
From: Michele Alberti <michele.alberti@cea.fr>
Date: Tue, 5 Apr 2022 18:26:16 +0200
Subject: [PATCH] Cleaner version of exception global matching/handling.

---
 src/main.ml | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/main.ml b/src/main.ml
index 6aa9a0b1..981eba2c 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -176,11 +176,10 @@ let default_cmd =
     Term.info caisar ~version ~doc ~sdocs ~exits:Term.default_exits ~man )
 
 let () =
-  try
-    match
-      Term.(eval_choice ~catch:false default_cmd [ config_cmd; verify_cmd ])
-    with
-    | `Error _ -> Caml.exit 1
-    | _ -> Caml.exit (if Logs.err_count () > 0 then 1 else 0)
-  with exn when not (log_level_is_debug ()) ->
+  match
+    Term.(eval_choice ~catch:false default_cmd [ config_cmd; verify_cmd ])
+  with
+  | `Error _ -> Caml.exit 1
+  | _ -> Caml.exit (if Logs.err_count () > 0 then 1 else 0)
+  | exception exn when not (log_level_is_debug ()) ->
     Fmt.epr "%a@." Why3.Exn_printer.exn_printer exn
-- 
GitLab