diff --git a/infer/src/base/CommandLineOption.ml b/infer/src/base/CommandLineOption.ml index eef4ce862..eba5c03b9 100644 --- a/infer/src/base/CommandLineOption.ml +++ b/infer/src/base/CommandLineOption.ml @@ -663,15 +663,15 @@ let anon_fun arg = command_switch () | Some command -> raise (Arg.Bad - ("More than one subcommand specified: " ^ string_of_command command ^ ", " ^ - arg)) + (Printf.sprintf "More than one subcommand specified: '%s', '%s'" + (string_of_command command) arg)) else match !anon_arg_action.on_unknown with | `Add -> rev_anon_args := arg::!rev_anon_args | `Skip -> () | `Reject -> - raise (Arg.Bad ("unexpected anonymous argument: " ^ arg)) + raise (Arg.Bad (Printf.sprintf "Unexpected anonymous argument: '%s'" arg)) let decode_inferconfig_to_argv path = diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 333b70ee6..8b98c571e 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -1653,7 +1653,7 @@ let post_parsing_initialization command_opt = Caml.Printexc.set_uncaught_exception_handler (fun exn _ -> let exn_msg = match exn with - | Failure msg -> msg + | Failure msg -> "ERROR: " ^ msg | _ -> "ERROR: " ^ Caml.Printexc.to_string exn in Format.eprintf "%s@?" exn_msg ); diff --git a/infer/src/base/Utils.ml b/infer/src/base/Utils.ml index 2424bada8..e4cee7d10 100644 --- a/infer/src/base/Utils.ml +++ b/infer/src/base/Utils.ml @@ -243,7 +243,7 @@ let shell_escape_command cmd = let create_dir dir = try if (Unix.stat dir).Unix.st_kind <> Unix.S_DIR then - failwithf "@.ERROR: file %s exists and is not a directory@." dir + failwithf "file %s exists and is not a directory@." dir with Unix.Unix_error _ -> try Unix.mkdir dir ~perm:0o700 with Unix.Unix_error _ -> @@ -251,7 +251,7 @@ let create_dir dir = try Polymorphic_compare.(=) ((Unix.stat dir).Unix.st_kind) Unix.S_DIR with Unix.Unix_error _ -> false in if not created_concurrently then - failwithf "@.ERROR: cannot create directory %s@." dir + failwithf "cannot create directory %s@." dir let realpath_cache = Hashtbl.create 1023 diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index 4a715e2ca..62449c001 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -1280,7 +1280,7 @@ let quotient_access_map acc_map = let (k_part, non_k_part) = AccessListMap.partition (fun k' _ -> may_alias tenv k k') m in if AccessListMap.is_empty k_part - then failwith "Error: may_alias is not reflexive!"; + then failwith "may_alias is not reflexive!"; let k_accesses = AccessListMap.fold (fun _ v acc' -> List.append v acc') diff --git a/infer/src/clang/ClangPointers.ml b/infer/src/clang/ClangPointers.ml index 5940920dc..6282d3932 100644 --- a/infer/src/clang/ClangPointers.ml +++ b/infer/src/clang/ClangPointers.ml @@ -31,7 +31,7 @@ let visit_ast | None -> () | Some error -> - failwithf "ERROR: visiting the clang AST failed with error %s" + failwithf "visiting the clang AST failed with error %s" (Ag_util.Validation.string_of_error error) let get_ptr_from_node node = diff --git a/infer/src/clang/cFrontend_checkers_main.ml b/infer/src/clang/cFrontend_checkers_main.ml index 113d16b9a..dfe11acc3 100644 --- a/infer/src/clang/cFrontend_checkers_main.ml +++ b/infer/src/clang/cFrontend_checkers_main.ml @@ -33,7 +33,7 @@ let already_imported_files = ref [] let rec parse_import_file import_file channel : CTL.clause list = if List.mem !already_imported_files import_file then - failwith ("[ERROR] Cyclic imports: file '" ^ import_file ^ "' was already imported.") + failwith ("Cyclic imports: file '" ^ import_file ^ "' was already imported.") else ( match parse_al_file import_file channel with | Some {import_files = imports; global_macros = curr_file_macros; checkers = _} -> diff --git a/infer/src/clang/cFrontend_errors.ml b/infer/src/clang/cFrontend_errors.ml index 3e3969c02..ae322115b 100644 --- a/infer/src/clang/cFrontend_errors.ml +++ b/infer/src/clang/cFrontend_errors.ml @@ -23,9 +23,9 @@ let filter_parsed_linters_developer parsed_linters = if List.length parsed_linters > 1 && Config.linters_developer_mode then match Config.linter with | None -> - failwith ("ERROR: In linters developer mode you should debug only one linter at a time. \ - This is important for debugging the rule. Pass the flag \ - --linter to specify the linter you want to debug."); + failwith "In linters developer mode you should debug only one linter at a time. \ + This is important for debugging the rule. Pass the flag \ + --linter to specify the linter you want to debug."; | Some lint -> List.filter ~f:( fun (rule : linter) -> String.equal rule.issue_desc.name lint @@ -250,7 +250,7 @@ let expand_formula phi _map _error_msg = let f1_sub = apply_substitution f1 sub in let map' = ALVar.FormulaIdMap.add av (true, fparams, f1) map in expand f1_sub map' error_msg' - | None -> failwith ("[ERROR]: Formula identifier '" ^ name ^ + | None -> failwith ("Formula identifier '" ^ name ^ "' is not called with the right number of parameters")) with Not_found -> acc)) (* in this case it should be a predicate *) | Not f1 -> Not (expand f1 map error_msg) @@ -275,7 +275,7 @@ let _build_macros_map macros init_map = let macros_map = List.fold ~f:(fun map' data -> match data with | CTL.CLet (key, params, formula) -> if ALVar.FormulaIdMap.mem key map' then - failwith ("[ERROR] Macro '" ^ (ALVar.formula_id_to_string key) ^ + failwith ("Macro '" ^ (ALVar.formula_id_to_string key) ^ "' has more than one definition.") else ALVar.FormulaIdMap.add key (false, params, formula) map' | _ -> map') ~init:init_map macros in diff --git a/infer/src/clang/ctl_parser.mly b/infer/src/clang/ctl_parser.mly index a4d2b12df..14d57d583 100644 --- a/infer/src/clang/ctl_parser.mly +++ b/infer/src/clang/ctl_parser.mly @@ -140,8 +140,8 @@ clause: { Logging.out "\tParsed SET clause\n"; let alvar = match $2 with | "report_when" -> ALVar.Report_when - | _ -> failwith ("[ERROR] string '%s' cannot be set to a variable. " ^ - "Use the reserverd variable 'report_when'\n") in + | _ -> failwith "string '%s' cannot be set to a variable. \ + Use the reserverd variable 'report_when'" in CTL.CSet (alvar, $4) } | SET identifier ASSIGNMENT STRING { Logging.out "\tParsed SET clause\n"; @@ -151,7 +151,7 @@ clause: | "severity" -> ALVar.Severity | "mode" -> ALVar.Mode | "path" -> ALVar.Path - | _ -> failwithf "[ERROR] string '%s' cannot be set in a SET clause. \ + | _ -> failwithf "string '%s' cannot be set in a SET clause. \ Use either of: \ 'message', 'mode', 'severity', 'suggestion' or 'path'" $2 in CTL.CDesc (alvar, $4) } diff --git a/infer/src/integration/Buck.ml b/infer/src/integration/Buck.ml index 10f25be58..2abdf4579 100644 --- a/infer/src/integration/Buck.ml +++ b/infer/src/integration/Buck.ml @@ -17,7 +17,7 @@ let target_of_string target = let flavors = String.split flavors_string ~on:',' in {name; flavors} | name::[] -> { name; flavors=[] } - | _ -> failwithf "Error: cannot parse target %s" target + | _ -> failwithf "cannot parse target %s" target let string_of_target { name; flavors } = let pp_string fmt s = Format.fprintf fmt "%s" s in diff --git a/infer/src/integration/CaptureCompilationDatabase.ml b/infer/src/integration/CaptureCompilationDatabase.ml index 987eb60d6..b777d54fe 100644 --- a/infer/src/integration/CaptureCompilationDatabase.ml +++ b/infer/src/integration/CaptureCompilationDatabase.ml @@ -94,7 +94,7 @@ let get_compilation_database_files_buck ~prog ~args = Utils.with_process_in buck_targets_shell In_channel.input_lines in match exit_or_signal with | Error _ as status -> - failwithf "*** ERROR: command failed:@\n*** %s@\n*** %s@." + failwithf "*** command failed:@\n*** %s@\n*** %s@." buck_targets_shell (Unix.Exit_or_signal.to_string_hum status) | Ok () -> diff --git a/infer/src/integration/Clang.ml b/infer/src/integration/Clang.ml index dcee59a6f..d69dda78a 100644 --- a/infer/src/integration/Clang.ml +++ b/infer/src/integration/Clang.ml @@ -45,6 +45,6 @@ let capture compiler ~prog ~args = |> function | Ok () -> () | Error _ as status -> - failwithf "*** ERROR: capture command failed:@\n*** %s@\n*** %s@." + failwithf "*** capture command failed:@\n*** %s@\n*** %s@." (String.concat ~sep:" " (prog::args)) (Unix.Exit_or_signal.to_string_hum status) diff --git a/infer/src/integration/Javac.ml b/infer/src/integration/Javac.ml index b66f8c839..97419ef14 100644 --- a/infer/src/integration/Javac.ml +++ b/infer/src/integration/Javac.ml @@ -63,7 +63,7 @@ let compile compiler build_prog build_args = k () | None, (`UnixError (err, log)) -> let verbose_errlog = Utils.with_file_in verbose_out_file ~f:In_channel.input_all in - failwithf "@\n*** ERROR Failed to execute compilation command: %s@\n*** Command: %s@\n\ + failwithf "@\n*** Failed to execute compilation command: %s@\n*** Command: %s@\n\ *** Output:@\n%s%s@\n*** Infer needs a working compilation command to run.@." (Unix.Exit_or_signal.to_string_hum (Error err)) shell_cmd log verbose_errlog; | None, (`ExceptionError exn) -> diff --git a/infer/src/integration/Maven.ml b/infer/src/integration/Maven.ml index 8dc0923d6..f3bb31986 100644 --- a/infer/src/integration/Maven.ml +++ b/infer/src/integration/Maven.ml @@ -157,6 +157,6 @@ let capture ~prog ~args = |> function | Ok () -> () | Error _ as status -> - failwithf "*** ERROR: Maven command failed:@\n*** %s@\n*** %s@\n" + failwithf "*** Maven command failed:@\n*** %s@\n*** %s@\n" (String.concat ~sep:" " (prog::capture_args)) (Unix.Exit_or_signal.to_string_hum status)