[infer] Change the error message when the project root is not a prefix of the absolute path of the source files

Summary:
More verbose error in the case where the project root is not a prefix of the source file path
master
jrm 9 years ago
parent 6de12aa5ba
commit a62c71290b

@ -16,8 +16,6 @@ module L = Logging
(** {2 Source Files} *)
exception Path_not_prefix_root
type source_file =
| Absolute of string
| Relative of string
@ -51,7 +49,7 @@ let rel_source_file_from_abs_path root fname =
if Utils.string_is_prefix root fname then
let relative_fname = filename_to_relative root fname in
Relative relative_fname
else raise Path_not_prefix_root
else failwith ("The project root " ^ root ^ " is not a prefix of " ^ fname)
(** convert a path to a source file, turning it into an absolute path if necessary *)
let abs_source_file_from_path fname =

@ -60,8 +60,6 @@ end
type source_file
exception Path_not_prefix_root
(** Maps from source_file *)
module SourceFileMap : Map.S with type key = source_file

@ -33,7 +33,9 @@ let source_file_from_path path =
| Some root ->
(try
DB.rel_source_file_from_abs_path root path
with DB.Path_not_prefix_root ->
with Failure _ ->
Logging.out
"ERROR: %s should be a prefix of %s.@." root path;
DB.source_file_from_string path)
| None -> DB.source_file_from_string path

Loading…
Cancel
Save