Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 66f910d9 authored by Bruno Guillaume's avatar Bruno Guillaume
Browse files

Catch exception when GRS file is not found

parent 2d2aa150
......@@ -17,7 +17,7 @@ module Grew_args = struct
type mode = Undefined | Gui of string | Transform | Grep | Test
let mode = ref Undefined
let grs = ref Grs.empty
let grs = ref None
let dep_dir = ref None
type output = Conll | Cupt | Gr | Dot
......@@ -100,7 +100,7 @@ module Grew_args = struct
let rec loop = function
| [] -> ()
| "-grs" :: file :: args -> grs := Grs.load file; loop args
| "-grs" :: file :: args -> grs := Some file; loop args
| "-i" :: files :: args ->
input_data := (Str.split (Str.regexp " ") files) @ !input_data; loop args
| "-o" :: file :: args -> output_file := Some file; loop args
......
......@@ -24,7 +24,7 @@ let fail msg = Log.fmessage "%s" msg; exit 2
let handle fct () =
try fct ()
with
| Conll_error json -> fail (Yojson.Basic.pretty_to_string json)
| Conll_error json -> fail (Yojson.Basic.pretty_to_string json)
| Libgrew.Error msg -> fail msg
| Corpus.File_not_found file -> fail (sprintf "File not found: \"%s\"" file)
| Corpus.Fail msg -> fail msg
......@@ -36,7 +36,10 @@ let handle fct () =
(* -------------------------------------------------------------------------------- *)
let transform () =
handle (fun () ->
let grs = !Grew_args.grs in
let grs = match !Grew_args.grs with
| None -> Grs.empty
| Some file -> Grs.load file in
let domain = Grs.domain grs in
let graph_array = Corpus.input ?domain () in
......@@ -81,7 +84,9 @@ let transform () =
| None -> Log.message "No pattern file specified: use -pattern option"; exit 1;
| Some pattern_file ->
let domain = Grs.domain !Grew_args.grs in
let domain = match !Grew_args.grs with
| None -> None
| Some file -> Grs.domain (Grs.load file) in
let pattern = Pattern.load ?domain pattern_file in
......
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