From da3cbbcef1f4de9780603225e095f026bb5da709 Mon Sep 17 00:00:00 2001 From: letouzey Date: Wed, 13 Mar 2013 00:00:08 +0000 Subject: Restrict (try...with...) to avoid catching critical exn (part 6) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16282 85f007b7-540e-0410-9357-904b9bb8a0f7 --- plugins/extraction/extract_env.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'plugins/extraction/extract_env.ml') diff --git a/plugins/extraction/extract_env.ml b/plugins/extraction/extract_env.ml index ae60259e9f..358fe2d01d 100644 --- a/plugins/extraction/extract_env.ml +++ b/plugins/extraction/extract_env.ml @@ -402,8 +402,10 @@ let mono_filename f = in let id = if lang () <> Haskell then default_id - else try Id.of_string (Filename.basename f) - with _ -> error "Extraction: provided filename is not a valid identifier" + else + try Id.of_string (Filename.basename f) + with UserError _ -> + error "Extraction: provided filename is not a valid identifier" in Some (f^d.file_suffix), Option.map ((^) f) d.sig_suffix, id @@ -541,7 +543,9 @@ let rec locate_ref = function | r::l -> let q = snd (qualid_of_reference r) in let mpo = try Some (Nametab.locate_module q) with Not_found -> None - and ro = try Some (Smartlocate.global_with_alias r) with _ -> None + and ro = + try Some (Smartlocate.global_with_alias r) + with Not_found | UserError _ -> None in match mpo, ro with | None, None -> Nametab.error_global_not_found q -- cgit v1.2.3