diff options
author | 2013-03-13 00:00:04 +0000 | |
---|---|---|
committer | 2013-03-13 00:00:04 +0000 | |
commit | 108e88cafee662932c99a83230f674f648866613 (patch) | |
tree | 949ee9b405efe3c5d70a3efc2d51ff997a159b81 /printing | |
parent | 027618d5aa99613ffbe390371cda492690809cc7 (diff) |
Restrict (try...with...) to avoid catching critical exn (part 5)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16281 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'printing')
-rw-r--r-- | printing/prettyp.ml | 7 | ||||
-rw-r--r-- | printing/printmod.ml | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/printing/prettyp.ml b/printing/prettyp.ml index f7f877ddf..4d7501ff9 100644 --- a/printing/prettyp.ml +++ b/printing/prettyp.ml @@ -266,7 +266,8 @@ let print_inductive_implicit_args = let print_inductive_renames = print_args_data_of_inductive_ids - (fun r -> try List.hd (Arguments_renaming.arguments_names r) with _ -> []) + (fun r -> + try List.hd (Arguments_renaming.arguments_names r) with Not_found -> []) ((!=) Anonymous) print_renames_list @@ -731,7 +732,7 @@ let print_coercions () = let index_of_class cl = try fst (class_info cl) - with _ -> + with Not_found -> errorlabstrm "index_of_class" (pr_class cl ++ spc() ++ str "not a defined class.") @@ -741,7 +742,7 @@ let print_path_between cls clt = let p = try lookup_path_between_class (i,j) - with _ -> + with Not_found -> errorlabstrm "index_cl_of_id" (str"No path between " ++ pr_class cls ++ str" and " ++ pr_class clt ++ str ".") diff --git a/printing/printmod.ml b/printing/printmod.ml index 57d990b86..fd9b1f200 100644 --- a/printing/printmod.ml +++ b/printing/printmod.ml @@ -127,7 +127,7 @@ let print_body is_impl env mp (l,body) = try let env = Option.get env in Printer.pr_mutual_inductive_body env (MutInd.make2 mp l) mib - with _ -> + with e when Errors.noncritical e -> (if mib.mind_finite then str "Inductive " else str "CoInductive") ++ name) @@ -135,7 +135,7 @@ let print_struct is_impl env mp struc = begin (* If [mp] is a globally visible module, we simply import it *) try Declaremods.really_import_module mp - with _ -> + with Not_found -> (* Otherwise we try to emulate an import by playing with nametab *) let fp = nametab_register_dir mp in List.iter (nametab_register_body mp fp) struc |