diff --git a/infer/src/backend/DB.ml b/infer/src/backend/DB.ml index be0721f44..8593b1154 100644 --- a/infer/src/backend/DB.ml +++ b/infer/src/backend/DB.ml @@ -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 = diff --git a/infer/src/backend/DB.mli b/infer/src/backend/DB.mli index dad9c3bdd..23c0b8581 100644 --- a/infer/src/backend/DB.mli +++ b/infer/src/backend/DB.mli @@ -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 diff --git a/infer/src/clang/cLocation.ml b/infer/src/clang/cLocation.ml index c2ac8a91b..72ed6d3d6 100644 --- a/infer/src/clang/cLocation.ml +++ b/infer/src/clang/cLocation.ml @@ -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