diff --git a/src/libraries/utils/json.mli b/src/libraries/utils/json.mli index ebfa936330dcdcd93971e0a9d62d845b2e5f0968..2549b3ae0765924d0214d67bfff4e2cb2086a402 100644 --- a/src/libraries/utils/json.mli +++ b/src/libraries/utils/json.mli @@ -178,6 +178,7 @@ val merge_array : Filepath.Normalized.t -> Yojson.Basic.t -> unit (** [from_file path] opens [path] and stores its JSON object in a memory cache, to be used by the other related functions. + @raise Yojson.Json_error if [path] is a malformed JSON file. @since Frama-C+dev *) val from_file: Filepath.Normalized.t -> Yojson.Basic.t diff --git a/src/plugins/value/utils/eva_audit.ml b/src/plugins/value/utils/eva_audit.ml index f7e10c46cf07a9449a120bde4371bba451f75233..c376dfe5fcabaafd1896520d4fb1cf48768f005e 100644 --- a/src/plugins/value/utils/eva_audit.ml +++ b/src/plugins/value/utils/eva_audit.ml @@ -135,10 +135,14 @@ let check_warning_status json name (module Plugin: Log.Messages) = (Pretty_utils.pp_list ~sep:", " Format.pp_print_string) should_be_enabled let check_configuration path = - let json = Json.from_file path in - check_correctness_parameters json; - check_warning_status json "Kernel" (module Kernel); - check_warning_status json "Eva" (module Value_parameters) + try + let json = Json.from_file path in + check_correctness_parameters json; + check_warning_status json "Kernel" (module Kernel); + check_warning_status json "Eva" (module Value_parameters) + with Yojson.Json_error msg -> + Kernel.abort "error reading JSON file %a: %s" + Filepath.Normalized.pretty path msg let print_configuration path = print_correctness_parameters path;