]> matita.cs.unibo.it Git - helm.git/blobdiff - matita/matita/matitaExcPp.ml
Most warnings turned into errors and avoided
[helm.git] / matita / matita / matitaExcPp.ml
index 04bdd6a3871af183948a1a81e68c7dc83c2a3d21..b0a5c7f12cbf91acb1e251c76d039cf564cf9309 100644 (file)
@@ -112,19 +112,19 @@ let compact_disambiguation_errors all_passes errorll =
    choices
 ;;
 
-let rec to_string = 
-  function
-  | HExtlib.Localized (floc,exn) ->
+let rec to_string exn =
+ try
+  (match exn with
+    HExtlib.Localized (floc,exn) ->
       let _,msg = to_string exn in
       let (x, y) = HExtlib.loc_of_floc floc in
        Some floc, sprintf "Error at %d-%d: %s" x y msg
+  | NCicLibrary.IncludedFileNotCompiled (s1,s2) ->
+      None, "Including: "^s1^" "^s2^ "\nNothing to do... did you run matitadep?"
   | GrafiteTypes.Command_error msg -> None, "Error: " ^ msg
   | CicNotationParser.Parse_error err ->
       None, sprintf "Parse error: %s" err
-  | UriManager.IllFormedUri uri -> None, sprintf "invalid uri: %s" uri
-  | CicEnvironment.Object_not_found uri ->
-      None, sprintf "object not found: %s" (UriManager.string_of_uri uri)
-  | Unix.Unix_error (code, api, param) ->
+  | Unix.Unix_error (code, api, _param) ->
       let err = Unix.error_message code in
       None, "Unix Error (" ^ api ^ "): " ^ err
   | HMarshal.Corrupt_file fname -> None, sprintf "file '%s' is corrupt" fname
@@ -133,19 +133,15 @@ let rec to_string =
       None,
       sprintf "format/version mismatch for file '%s', please recompile it'"
         fname
-  | ProofEngineTypes.Fail msg -> None, "Tactic error: " ^ Lazy.force msg
   | Continuationals.Error s -> None, "Tactical error: " ^ Lazy.force s
-  | ProofEngineHelpers.Bad_pattern msg ->
-     None, "Bad pattern: " ^ Lazy.force msg
-  | CicRefine.RefineFailure msg
-  | CicRefine.AssertFailure msg ->
-     None, "Refiner error: " ^ Lazy.force msg
   | NCicRefiner.RefineFailure msg ->
      None, "NRefiner failure: " ^ snd (Lazy.force msg)
   | NCicRefiner.Uncertain msg ->
      None, "NRefiner uncertain: " ^ snd (Lazy.force msg)
   | NCicMetaSubst.Uncertain msg ->
      None, "NCicMetaSubst uncertain: " ^ Lazy.force msg
+  | NCicMetaSubst.MetaSubstFailure msg ->
+     None, "NCicMetaSubst failure: " ^ Lazy.force msg
   | NCicTypeChecker.TypeCheckerFailure msg ->
      None, "NTypeChecker failure: " ^ Lazy.force msg
   | NCicTypeChecker.AssertFailure msg ->
@@ -154,6 +150,15 @@ let rec to_string =
      None, "NCicEnvironment object not found: " ^ Lazy.force msg
   | NCicEnvironment.AlreadyDefined msg ->
      None, "NCicEnvironment already defined: " ^ Lazy.force msg
+  | MatitaEngine.CircularDependency fname ->
+      None, "Circular dependency including " ^ fname
+  | MatitaEngine.TryingToAdd msg ->
+     None, "Attempt to insert an alias in batch mode: " ^ Lazy.force msg
+  | MatitaEngine.AlreadyLoaded msg ->
+     None, "The file " ^ Lazy.force msg ^ " needs recompilation but it is
+     already loaded; undo the inclusion and try again."
+  | MatitaEngine.FailureCompiling (filename,exn) ->
+     None, "Compiling " ^ filename ^ ":\n" ^ snd (to_string exn)
   | NCicRefiner.AssertFailure msg ->
      None, "NRefiner assert failure: " ^ Lazy.force msg
   | NCicEnvironment.BadDependency (msg,e) ->
@@ -165,16 +170,12 @@ let rec to_string =
      None, "NCicUnification failure: " ^ Lazy.force msg
   | NCicUnification.Uncertain msg ->
      None, "NCicUnification uncertain: " ^ Lazy.force msg
-  | CicTypeChecker.TypeCheckerFailure msg ->
-     None, "Type checking error: " ^ Lazy.force msg
-  | CicTypeChecker.AssertFailure msg ->
-     None, "Type checking assertion failed: " ^ Lazy.force msg
-  | LibrarySync.AlreadyDefined s -> 
-     None, "Already defined: " ^ UriManager.string_of_uri s
   | DisambiguateChoices.Choice_not_found msg ->
      None, ("Disambiguation choice not found: " ^ Lazy.force msg)
+  | DisambiguateTypes.Invalid_choice msg ->
+     None, ("Invalid choice: " ^ snd (Lazy.force msg))
   | MatitaEngine.EnrichedWithStatus (exn,_) ->
-     None, "EnrichedWithStatus "^snd(to_string exn)
+     None, snd(to_string exn)
   | NTacStatus.Error (msg,None) ->
      None, "NTactic error: " ^ Lazy.force msg 
   | NTacStatus.Error (msg,Some exn) ->
@@ -238,5 +239,7 @@ let rec to_string =
       loc,
        "********** DISAMBIGUATION ERRORS: **********\n" ^
         explain (aux errorll)
-  | exn -> None, "Uncaught exception: " ^ Printexc.to_string exn
-
+  | exn -> None, ("Uncaught exception: " ^ Printexc.to_string exn ^ Printexc.get_backtrace ()))
+ with exn ->
+  None, ("Exception raised during pretty-printing of an exception: " ^
+   snd (to_string exn))