Simplify common case of unit-wide errors.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14111 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
6950d6f780
commit
de72ef4a89
|
@ -147,12 +147,8 @@ let report_error ppf = function
|
|||
let () =
|
||||
Location.register_error_of_exn
|
||||
(function
|
||||
| Error err ->
|
||||
Some
|
||||
(Location.error_of_printer
|
||||
(Location.in_file !Location.input_name) report_error err)
|
||||
| _ ->
|
||||
None
|
||||
| Error err -> Some (Location.error_of_printer_file report_error err)
|
||||
| _ -> None
|
||||
)
|
||||
|
||||
let parse_all parse_fun magic ppf sourcefile =
|
||||
|
|
|
@ -343,3 +343,6 @@ let error_of_printer loc print x =
|
|||
pp_print_flush ppf ();
|
||||
let msg = Buffer.contents buf in
|
||||
errorf ~loc "Error: %s" msg
|
||||
|
||||
let error_of_printer_file print x =
|
||||
error_of_printer (in_file !input_name) print x
|
||||
|
|
|
@ -93,6 +93,8 @@ val errorf: ?loc:t -> ?sub:error list -> ?if_highlight:string -> ('a, unit, stri
|
|||
|
||||
val error_of_printer: t -> (formatter -> 'a -> unit) -> 'a -> error
|
||||
|
||||
val error_of_printer_file: (formatter -> 'a -> unit) -> 'a -> error
|
||||
|
||||
val error_of_exn: exn -> error option
|
||||
|
||||
val register_error_of_exn: (exn -> error option) -> unit
|
||||
|
|
|
@ -1609,11 +1609,7 @@ let report_error ppf = function
|
|||
let () =
|
||||
Location.register_error_of_exn
|
||||
(function
|
||||
| Error err ->
|
||||
Some
|
||||
(Location.error_of_printer
|
||||
(Location.in_file !Location.input_name) report_error err)
|
||||
| _ ->
|
||||
None
|
||||
| Error err -> Some (Location.error_of_printer_file report_error err)
|
||||
| _ -> None
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue