Skip to content

Commit

Permalink
Don't backtrace on invalid input in compile-deps
Browse files Browse the repository at this point in the history
Closes ocaml#983
  • Loading branch information
jonludlam committed Feb 13, 2025
1 parent d88e04c commit be254f4
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions src/odoc/bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1410,15 +1410,29 @@ end)
module Depends = struct
module Compile = struct
let list_dependencies input_files =
let deps =
Depends.for_compile_step (List.map ~f:Fs.File.of_string input_files)
in
List.iter
~f:(fun t ->
Printf.printf "%s %s\n" (Depends.Compile.name t)
(Digest.to_hex @@ Depends.Compile.digest t))
deps;
flush stdout
try
let deps =
Depends.for_compile_step (List.map ~f:Fs.File.of_string input_files)
in
List.iter
~f:(fun t ->
Printf.printf "%s %s\n" (Depends.Compile.name t)
(Digest.to_hex @@ Depends.Compile.digest t))
deps;
flush stdout
with Cmi_format.Error e ->
let msg =
match e with
| Not_an_interface file ->
Printf.sprintf "File %S is not an interface" file
| Wrong_version_interface (file, v) ->
Printf.sprintf "File %S is compiled for %s version of OCaml" file
v
| Corrupted_interface file ->
Printf.sprintf "File %S is corrupted" file
in
Printf.eprintf "ERROR: %s\n%!" msg;
exit 1

let cmd =
let input =
Expand Down

0 comments on commit be254f4

Please sign in to comment.