From 224fc18517e449c05cc27670ffe6a0548b77eae3 Mon Sep 17 00:00:00 2001
From: Pierre Wilke <pierre.wilke@centralesupelec.fr>
Date: Tue, 2 Mar 2021 11:08:19 +0100
Subject: [PATCH] Gestion un peu meilleure des exceptions

---
 src/main.ml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/main.ml b/src/main.ml
index abae9ca..e107385 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -181,6 +181,7 @@ let _ =
       end;
 
       let compiler_res =
+        try
         pass_tokenize input >>= fun tokens ->
         pass_parse tokens >>= fun (ast, _) ->
         pass_elang ast >>= fun ep ->
@@ -200,6 +201,10 @@ let _ =
         pass_linear_dse linear lives >>= fun linear ->
         run "Linear after DSE" !linear_run_after_dse exec_linear_prog linear;
         pass_ltl_gen linear
+        with e ->
+          let emsg = Printexc.to_string e ^ "\n" ^ Printexc.get_backtrace () in
+          record_compile_result ~error:(Some emsg) "global";
+          Error emsg
       in
       begin
         match compiler_res with
-- 
GitLab