aboutsummaryrefslogtreecommitdiff
path: root/plugins/extraction/extract_env.ml
diff options
context:
space:
mode:
authorletouzey2013-03-13 00:00:08 +0000
committerletouzey2013-03-13 00:00:08 +0000
commitda3cbbcef1f4de9780603225e095f026bb5da709 (patch)
tree245855016cea9d25fcd643f841bc868bd81ec440 /plugins/extraction/extract_env.ml
parent108e88cafee662932c99a83230f674f648866613 (diff)
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
Diffstat (limited to 'plugins/extraction/extract_env.ml')
-rw-r--r--plugins/extraction/extract_env.ml10
1 files changed, 7 insertions, 3 deletions
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