Skip to content

Commit 8c4f836

Browse files
committed
Adress comments
1 parent 65dda8b commit 8c4f836

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

jscomp/bsb/bsb_pkg.ml

+9-6
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,15 @@ let rec find_dep_path ic package_name =
114114
|> Ext_string.split_by (fun c -> c ='"')
115115
|> List.hd
116116
else
117-
find_dep_path ic package_name
117+
find_dep_path ic package_name
118118

119119
let get_dep_path_from_file ~cwd package =
120120
(* We should find the correct file if we move 3 steps up because we're in _esy/<sandbox>/store/b/<build> *)
121-
let ic = open_in_bin Ext_path.(cwd // ".." // ".." // ".." // "installation.json") in
122-
let package_name = Bsb_pkg_types.to_string package in
123-
find_dep_path ic package_name
121+
try
122+
let ic = open_in_bin Ext_path.(cwd // ".." // ".." // ".." // "installation.json") in
123+
let package_name = Bsb_pkg_types.to_string package in
124+
Some(find_dep_path ic package_name)
125+
with _ -> None
124126

125127
(** TODO: collect all warnings and print later *)
126128
let resolve_bs_package ~cwd (package : t) =
@@ -137,8 +139,9 @@ let resolve_bs_package ~cwd (package : t) =
137139
(Bsb_pkg_types.to_string package)
138140
custom_pkg_loc;
139141

140-
try get_dep_path_from_file ~cwd package
141-
with _ -> Bsb_exception.package_not_found ~pkg:package ~json:None
142+
match get_dep_path_from_file ~cwd package with
143+
| Some dep_path -> dep_path
144+
| None -> Bsb_exception.package_not_found ~pkg:package ~json:None
142145
end
143146
| path when not (Sys.file_exists path) ->
144147
begin

0 commit comments

Comments
 (0)