Skip to content

Commit

Permalink
Catch required files that do not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
sarranz committed Feb 16, 2024
1 parent cfa8e72 commit d89796a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/src/pretyping.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2079,7 +2079,12 @@ and tt_file arch_info env from loc fname =
| None -> env, []
| Some(env, fname) ->
let ast = Parseio.parse_program ~name:fname in
let ast = BatFile.with_file_in fname ast in
let ast =
try BatFile.with_file_in fname ast
with Sys_error(err) ->
let loc = Option.map_default (fun l -> Lone l) Lnone loc in
hierror ~loc ~kind:"typing" "error reading file \"%s\" (%s)" fname err
in
let env = List.fold_left (tt_item arch_info) env ast in
Env.exit_file env, ast

Expand Down

0 comments on commit d89796a

Please sign in to comment.