Commit 5a43e342 authored by bguillaum's avatar bguillaum

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
parent c667c9e5
......@@ -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
) ()
......
......@@ -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 *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment