Change an error into a warning
Otherwise this breaks the build of atd.
This commit is contained in:
parent
6f20a3d938
commit
9df1bad58c
|
@ -649,15 +649,12 @@ module Executables = struct
|
||||||
in
|
in
|
||||||
match to_install with
|
match to_install with
|
||||||
| [] ->
|
| [] ->
|
||||||
map_validate (field_o "package" string) ~f:(function
|
(field_o "package" Sexp.Ast.loc >>= function
|
||||||
| None -> Ok ()
|
| None -> return (t, None)
|
||||||
| Some _ ->
|
| Some loc ->
|
||||||
Error
|
Loc.warn loc "This field is useless without a (public_name%s ...) field."
|
||||||
(sprintf
|
(if multi then "s" else "");
|
||||||
"this field is useless without a (public_name%s ...) field"
|
return (t, None))
|
||||||
(if multi then "s" else "")))
|
|
||||||
>>= fun () ->
|
|
||||||
return (t, None)
|
|
||||||
| files ->
|
| files ->
|
||||||
Pkgs.package_field pkgs >>= fun package ->
|
Pkgs.package_field pkgs >>= fun package ->
|
||||||
return (t, Some { Install_conf. section = Bin; files; package })
|
return (t, Some { Install_conf. section = Bin; files; package })
|
||||||
|
|
10
src/loc.ml
10
src/loc.ml
|
@ -31,3 +31,13 @@ let in_file fn =
|
||||||
}
|
}
|
||||||
|
|
||||||
let none = in_file "<none>"
|
let none = in_file "<none>"
|
||||||
|
|
||||||
|
let print ppf { start; stop } =
|
||||||
|
let start_c = start.pos_cnum - start.pos_bol in
|
||||||
|
let stop_c = stop.pos_cnum - start.pos_bol in
|
||||||
|
Format.fprintf ppf
|
||||||
|
"@{<loc>File \"%s\", line %d, characters %d-%d:@}@\n"
|
||||||
|
start.pos_fname start.pos_lnum start_c stop_c
|
||||||
|
|
||||||
|
let warn t fmt =
|
||||||
|
Format.eprintf ("%a@{<warning>Warning@}: " ^^ fmt ^^ "@.") print t
|
||||||
|
|
|
@ -13,3 +13,9 @@ val fail_lex : Lexing.lexbuf -> ('a, unit, string, _) format4 -> 'a
|
||||||
val in_file : string -> t
|
val in_file : string -> t
|
||||||
|
|
||||||
val none : t
|
val none : t
|
||||||
|
|
||||||
|
(** Prints "File ..., line ..., characters ...:\n" *)
|
||||||
|
val print : Format.formatter -> t -> unit
|
||||||
|
|
||||||
|
(** Prints a warning *)
|
||||||
|
val warn : t -> ('a, Format.formatter, unit) format -> 'a
|
||||||
|
|
14
src/main.ml
14
src/main.ml
|
@ -77,13 +77,13 @@ let external_lib_deps ?log ~packages () =
|
||||||
|
|
||||||
let report_error ?(map_fname=fun x->x) ppf exn ~backtrace =
|
let report_error ?(map_fname=fun x->x) ppf exn ~backtrace =
|
||||||
match exn with
|
match exn with
|
||||||
| Loc.Error ({ start; stop }, msg) ->
|
| Loc.Error (loc, msg) ->
|
||||||
let start_c = start.pos_cnum - start.pos_bol in
|
let loc =
|
||||||
let stop_c = stop.pos_cnum - start.pos_bol in
|
{ loc with
|
||||||
Format.fprintf ppf
|
start = { loc.start with pos_fname = map_fname loc.start.pos_fname }
|
||||||
"@{<loc>File \"%s\", line %d, characters %d-%d:@}\n\
|
}
|
||||||
@{<error>Error@}: %s\n"
|
in
|
||||||
(map_fname start.pos_fname) start.pos_lnum start_c stop_c msg
|
Format.fprintf ppf "%a@{<error>Error@}: %s\n" Loc.print loc msg
|
||||||
| Fatal_error "" -> ()
|
| Fatal_error "" -> ()
|
||||||
| Fatal_error msg ->
|
| Fatal_error msg ->
|
||||||
Format.fprintf ppf "%s\n" (String.capitalize_ascii msg)
|
Format.fprintf ppf "%s\n" (String.capitalize_ascii msg)
|
||||||
|
|
Loading…
Reference in New Issue