Skip to content

Commit 4ef6b60

Browse files
authored
fix: catch file not found error when finding location snippet (#1673)
1 parent bdd0c0e commit 4ef6b60

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

jscomp/core/ast_io.cppo.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ let set_input_lexbuf () =
123123
in
124124
begin match set_input_lexbuf !Location.input_name with
125125
| (_ : Lexing.lexbuf) -> ()
126+
| exception Unix.Unix_error (Unix.ENOENT, _, _)
126127
| exception Sys_error _ -> ()
127128
end
128129

test/blackbox-tests/ppx-location-snippet.t

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,8 @@ Test that the location snippet appears in a ppx-processed compilation error
1818

1919
$ export DUNE_SANDBOX=symlink
2020
$ dune build @melange
21-
File "dune", lines 1-4, characters 0-81:
22-
1 | (melange.emit
23-
2 | (target out)
24-
3 | (emit_stdlib false)
25-
4 | (preprocess (pps melange.ppx)))
26-
melc: internal error, uncaught exception:
27-
Unix.Unix_error(Unix.ENOENT, "open", "foo.ml")
28-
21+
File "foo.ml", line 1, characters 7-11:
22+
Error: Unbound type constructor nope
2923
[1]
3024

3125
$ export DUNE_SANDBOX=none

0 commit comments

Comments
 (0)