From 5a43e3426071405cd1b318585589d27e41071738 Mon Sep 17 00:00:00 2001 From: bguillaum Date: Fri, 13 May 2016 10:04:01 +0000 Subject: [PATCH] Change exception name and reraise it in error handler git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/semagramme/libcaml-grew/trunk@8956 7838e531-6607-4d57-9587-6c381814729c --- src/libgrew.ml | 7 ++++--- src/libgrew.mli | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libgrew.ml b/src/libgrew.ml index c30b50f..abac59d 100644 --- a/src/libgrew.ml +++ b/src/libgrew.ml @@ -24,7 +24,7 @@ end (* ==================================================================================================== *) (** {2 Exceptions} *) (* ==================================================================================================== *) -exception File_dont_exists of string +exception File_not_found of string exception Parsing_err of string * Loc.t option exception Build of string * Loc.t option exception Run of string * Loc.t option @@ -37,6 +37,7 @@ let handle ?(name="") ?(file="No file defined") fct () = | Build (msg,loc_opt) -> raise (Build (msg,loc_opt)) | Bug (msg, loc_opt) -> raise (Bug (msg,loc_opt)) | Run (msg, loc_opt) -> raise (Run (msg,loc_opt)) + | File_not_found file -> raise (File_not_found file) (* Catch new exceptions *) | Grew_loader.Loader.Error (msg, loc_opt) -> raise (Parsing_err (msg, loc_opt)) @@ -97,7 +98,7 @@ type t = Grew_graph.G_graph.t let load_gr domain file = if not (Sys.file_exists file) - then raise (File_dont_exists file) + then raise (File_not_found file) else handle ~name:"Graph.load_gr" ~file (fun () -> @@ -185,7 +186,7 @@ module Grs = struct handle ~name:"Grs.load" ~file (fun () -> if not (Sys.file_exists file) - then raise (File_dont_exists file) + then raise (File_not_found file) else Grew_grs.Grs.build file ) () diff --git a/src/libgrew.mli b/src/libgrew.mli index ec7d1b6..70f9e58 100644 --- a/src/libgrew.mli +++ b/src/libgrew.mli @@ -22,7 +22,7 @@ end (* ==================================================================================================== *) (** {2 Exceptions} *) (* ==================================================================================================== *) -exception File_dont_exists of string +exception File_not_found of string exception Parsing_err of string * Loc.t option @@ -82,7 +82,7 @@ module Graph : sig (** get a graph from a file either in 'gr' or 'conll' format. File extension should be '.gr' or '.conll'. @raise Parsing_err if libgrew can't parse the file - @raise File_dont_exists if the file doesn't exists. *) + @raise File_not_found if the file doesn't exists. *) val load: Domain.t -> string -> t val of_conll: Domain.t -> Conll.t -> t @@ -125,7 +125,7 @@ module Grs: sig (** [load filename] loads a graph rewriting system from [filename] @raise Parsing_err if libgrew can't parse the file - @raise File_dont_exists if the file doesn't exists *) + @raise File_not_found if the file doesn't exists *) val load: string -> t (** [get_sequence_names t] returns the list of sequence names defined in a GRS *) -- GitLab