Keep input file in Env.Error. Switch it to the new system.
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/exception_registration@14109 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
d18a044380
commit
290fe0c0b2
|
@ -218,7 +218,7 @@ let main () =
|
|||
with
|
||||
Toplevel ->
|
||||
exit 2
|
||||
| Env.Error e ->
|
||||
| Env.Error (e, _) ->
|
||||
eprintf "Debugger [version %s] environment error:@ @[@;" Config.version;
|
||||
Env.report_error err_formatter e;
|
||||
eprintf "@]@.";
|
||||
|
|
|
@ -21,9 +21,6 @@ open Format
|
|||
|
||||
let report_error ppf exn =
|
||||
let report ppf = function
|
||||
| Env.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Env.report_error ppf err
|
||||
| Cmi_format.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Cmi_format.report_error ppf err
|
||||
|
|
|
@ -20,9 +20,6 @@ open Format
|
|||
|
||||
let report_error ppf exn =
|
||||
let report ppf = function
|
||||
| Env.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Env.report_error ppf err
|
||||
| Cmi_format.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Cmi_format.report_error ppf err
|
||||
|
|
|
@ -148,7 +148,8 @@ let () =
|
|||
Location.register_error_of_exn
|
||||
(function
|
||||
| Error (err, file) ->
|
||||
Some (Location.error_of_printer (Location.in_file file) report_error err)
|
||||
Some
|
||||
(Location.error_of_printer (Location.in_file file) report_error err)
|
||||
| _ ->
|
||||
None
|
||||
)
|
||||
|
|
|
@ -108,9 +108,6 @@ module Sig_analyser = Odoc_sig.Analyser (Odoc_comments.Basic_info_retriever)
|
|||
differences only concern code generation (i believe).*)
|
||||
let process_error exn =
|
||||
let report ppf = function
|
||||
| Env.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Env.report_error ppf err
|
||||
| Cmi_format.Error err ->
|
||||
Location.print_error_cur_file ppf;
|
||||
Cmi_format.report_error ppf err
|
||||
|
|
|
@ -58,7 +58,9 @@ type error =
|
|||
| Inconsistent_import of string * string * string
|
||||
| Need_recursive_types of string * string
|
||||
|
||||
exception Error of error
|
||||
exception Error of error * string
|
||||
|
||||
let error err = raise (Error (err, !Location.input_name))
|
||||
|
||||
module EnvLazy : sig
|
||||
type ('a,'b) t
|
||||
|
@ -289,7 +291,7 @@ let check_consistency filename crcs =
|
|||
(fun (name, crc) -> Consistbl.check crc_units name crc filename)
|
||||
crcs
|
||||
with Consistbl.Inconsistency(name, source, auth) ->
|
||||
raise(Error(Inconsistent_import(name, auth, source)))
|
||||
error (Inconsistent_import(name, auth, source))
|
||||
|
||||
(* Reading persistent structures from .cmi files *)
|
||||
|
||||
|
@ -310,12 +312,12 @@ let read_pers_struct modname filename = (
|
|||
ps_filename = filename;
|
||||
ps_flags = flags } in
|
||||
if ps.ps_name <> modname then
|
||||
raise(Error(Illegal_renaming(modname, ps.ps_name, filename)));
|
||||
error (Illegal_renaming(modname, ps.ps_name, filename));
|
||||
check_consistency filename ps.ps_crcs;
|
||||
List.iter
|
||||
(function Rectypes ->
|
||||
if not !Clflags.recursive_types then
|
||||
raise(Error(Need_recursive_types(ps.ps_name, !current_unit))))
|
||||
error (Need_recursive_types(ps.ps_name, !current_unit)))
|
||||
ps.ps_flags;
|
||||
Hashtbl.add persistent_structures modname (Some ps);
|
||||
ps
|
||||
|
@ -1603,3 +1605,14 @@ let report_error ppf = function
|
|||
fprintf ppf
|
||||
"@[<hov>Unit %s imports from %s, which uses recursive types.@ %s@]"
|
||||
export import "The compilation flag -rectypes is required"
|
||||
|
||||
let () =
|
||||
Location.register_error_of_exn
|
||||
(function
|
||||
| Error (err, file) ->
|
||||
Some
|
||||
(Location.error_of_printer (Location.in_file file) report_error err)
|
||||
| _ ->
|
||||
None
|
||||
)
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ type error =
|
|||
| Inconsistent_import of string * string * string
|
||||
| Need_recursive_types of string * string
|
||||
|
||||
exception Error of error
|
||||
exception Error of error * string (* file name *)
|
||||
|
||||
open Format
|
||||
|
||||
|
|
Loading…
Reference in New Issue