23
23
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
24
24
25
25
type error =
26
- | Package_not_found of Bsb_pkg_types .t * string option (* json file *)
26
+ | Package_not_found of Bsb_pkg_types .t
27
27
| Json_config of Ext_position .t * string
28
- | Invalid_json of string
29
28
| Invalid_spec of string
30
29
| Conflict_module of string * string * string
31
30
| No_implementation of string
32
- | Not_consistent of string
33
31
34
32
exception Error of error
35
33
36
34
let error err = raise (Error err)
37
35
38
- let package_not_found ~pkg ~ json = error (Package_not_found ( pkg, json) )
36
+ let package_not_found ~pkg = error (Package_not_found pkg)
39
37
40
38
let print (fmt : Format.formatter ) (x : error ) =
41
39
match x with
42
40
| Conflict_module (modname , dir1 , dir2 ) ->
43
41
Format. fprintf fmt
44
42
" @{<error>Error:@} %s found in two directories: (%s, %s)\n \
45
43
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
51
44
| No_implementation modname ->
52
45
Format. fprintf fmt " @{<error>Error:@} %s does not have implementation file"
53
46
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 ->
60
48
let name = Bsb_pkg_types. to_string name in
61
49
if Ext_string. equal name ! Bs_version. package_name then
62
50
Format. fprintf fmt
63
51
" 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 \
65
53
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
67
55
else
68
56
Format. fprintf fmt
69
57
" 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
72
60
| Json_config (pos , s ) ->
73
61
Format. fprintf fmt
74
62
" File %S, line %d:\n \
@@ -78,17 +66,12 @@ let print (fmt : Format.formatter) (x : error) =
78
66
pos.pos_fname pos.pos_lnum s
79
67
| Invalid_spec s ->
80
68
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
84
69
85
70
let conflict_module modname dir1 dir2 =
86
71
Error (Conflict_module (modname, dir1, dir2))
87
72
88
73
let no_implementation modname = error (No_implementation modname)
89
74
90
- let not_consistent modname = error (Not_consistent modname)
91
-
92
75
let errorf ~loc fmt =
93
76
Format. ksprintf (fun s -> error (Json_config (loc, s))) fmt
94
77
@@ -99,8 +82,6 @@ let config_error config fmt =
99
82
100
83
let invalid_spec s = error (Invalid_spec s)
101
84
102
- let invalid_json s = error (Invalid_json s)
103
-
104
85
let () =
105
86
Printexc. register_printer (fun x ->
106
87
match x with
0 commit comments