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.

Signed-off-by: ivg <[email protected]>
  • Loading branch information
ivg committed Jan 10, 2023
1 parent 3707ca4 commit 467c383
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 467c383

Please sign in to comment.