Skip to content

Commit

Permalink
adds minimal error-handling
Browse files Browse the repository at this point in the history
Now instead of ignoring errors and spoiling stderr, we capture the
output and failwith the captured message.
  • Loading branch information
ivg committed Aug 18, 2022
1 parent da2155b commit 8067469
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion otherlibs/site/src/plugins/linker/toplevel/linker.ml
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
let load = Topdirs.dir_load Format.err_formatter
let load filename =
let buf = Buffer.create 16 in
let ppf = Format.formatter_of_buffer buf in
match Toploop.load_file ppf filename with
| true -> ()
| false ->
Format.pp_print_flush ppf ();
failwith
@@ Format.asprintf "Failed to load file `%s': %s" filename
(Buffer.contents buf)

0 comments on commit 8067469

Please sign in to comment.