2323 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424
2525type error =
26- | Package_not_found of Bsb_pkg_types .t * string option (* json file *)
26+ | Package_not_found of Bsb_pkg_types .t
2727 | Json_config of Ext_position .t * string
28- | Invalid_json of string
2928 | Invalid_spec of string
3029 | Conflict_module of string * string * string
3130 | No_implementation of string
32- | Not_consistent of string
3331
3432exception Error of error
3533
3634let error err = raise (Error err)
3735
38- let package_not_found ~pkg ~ json = error (Package_not_found ( pkg, json) )
36+ let package_not_found ~pkg = error (Package_not_found pkg)
3937
4038let print (fmt : Format.formatter ) (x : error ) =
4139 match x with
4240 | Conflict_module (modname , dir1 , dir2 ) ->
4341 Format. fprintf fmt
4442 " @{<error>Error:@} %s found in two directories: (%s, %s)\n \
4543 File names must be unique per project" modname dir1 dir2
46- | Not_consistent modname ->
47- Format. fprintf fmt
48- " @{<error>Error:@} %s has implementation/interface in non-consistent \
49- syntax(reason/ocaml)"
50- modname
5144 | No_implementation modname ->
5245 Format. fprintf fmt " @{<error>Error:@} %s does not have implementation file"
5346 modname
54- | Package_not_found (name , json_opt ) ->
55- let in_json =
56- match json_opt with
57- | None -> Ext_string. empty
58- | Some x -> " in " ^ x
59- in
47+ | Package_not_found name ->
6048 let name = Bsb_pkg_types. to_string name in
6149 if Ext_string. equal name ! Bs_version. package_name then
6250 Format. fprintf fmt
6351 " File \" bsconfig.json\" , line 1\n \
64- @{<error>Error:@} package @{<error>%s@} is not found %s \n \
52+ @{<error>Error:@} package @{<error>%s@} is not found\n \
6553 It's the basic, required package. If you have it installed globally,\n \
66- Please run `npm link rescript` to make it available" name in_json
54+ Please run `npm link rescript` to make it available" name
6755 else
6856 Format. fprintf fmt
6957 " File \" bsconfig.json\" , line 1\n \
70- @{<error>Error:@} package @{<error>%s@} not found or built %s \n \
71- - Did you install it?" name in_json
58+ @{<error>Error:@} package @{<error>%s@} not found or built\n \
59+ - Did you install it?" name
7260 | Json_config (pos , s ) ->
7361 Format. fprintf fmt
7462 " File %S, line %d:\n \
@@ -78,17 +66,12 @@ let print (fmt : Format.formatter) (x : error) =
7866 pos.pos_fname pos.pos_lnum s
7967 | Invalid_spec s ->
8068 Format. fprintf fmt " @{<error>Error: Invalid bsconfig.json %s@}" s
81- | Invalid_json s ->
82- Format. fprintf fmt " File %S, line 1\n @{<error>Error: Invalid json format@}"
83- s
8469
8570let conflict_module modname dir1 dir2 =
8671 Error (Conflict_module (modname, dir1, dir2))
8772
8873let no_implementation modname = error (No_implementation modname)
8974
90- let not_consistent modname = error (Not_consistent modname)
91-
9275let errorf ~loc fmt =
9376 Format. ksprintf (fun s -> error (Json_config (loc, s))) fmt
9477
@@ -99,8 +82,6 @@ let config_error config fmt =
9982
10083let invalid_spec s = error (Invalid_spec s)
10184
102- let invalid_json s = error (Invalid_json s)
103-
10485let () =
10586 Printexc. register_printer (fun x ->
10687 match x with
0 commit comments