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
|
||||
match to_install with
|
||||
| [] ->
|
||||
map_validate (field_o "package" string) ~f:(function
|
||||
| None -> Ok ()
|
||||
| Some _ ->
|
||||
Error
|
||||
(sprintf
|
||||
"this field is useless without a (public_name%s ...) field"
|
||||
(if multi then "s" else "")))
|
||||
>>= fun () ->
|
||||
return (t, None)
|
||||
(field_o "package" Sexp.Ast.loc >>= function
|
||||
| None -> return (t, None)
|
||||
| Some loc ->
|
||||
Loc.warn loc "This field is useless without a (public_name%s ...) field."
|
||||
(if multi then "s" else "");
|
||||
return (t, None))
|
||||
| files ->
|
||||
Pkgs.package_field pkgs >>= fun 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 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 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 =
|
||||
match exn with
|
||||
| Loc.Error ({ start; stop }, msg) ->
|
||||
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\
|
||||
@{<error>Error@}: %s\n"
|
||||
(map_fname start.pos_fname) start.pos_lnum start_c stop_c msg
|
||||
| Loc.Error (loc, msg) ->
|
||||
let loc =
|
||||
{ loc with
|
||||
start = { loc.start with pos_fname = map_fname loc.start.pos_fname }
|
||||
}
|
||||
in
|
||||
Format.fprintf ppf "%a@{<error>Error@}: %s\n" Loc.print loc msg
|
||||
| Fatal_error "" -> ()
|
||||
| Fatal_error msg ->
|
||||
Format.fprintf ppf "%s\n" (String.capitalize_ascii msg)
|
||||
|
|
Loading…
Reference in New Issue