Expose Persistent_env.Error and catch it from the debugger
The debugger reimplements its own error-reporting logic without using the reporter-registration mechanism of the compiler, so it needs to be adapted after the split between `Env` and `Persistent_env` in #2228. (Interestingly, this forced me to expose the `Error of error` exception in the Persistent_signature, which was not the case before. It was probably a mistake to not expose an exception value that can be raised by (correctly-written) consumers of the module.) I noticed the issue while inspecting a testsuite failure (#8544). Before this patch: ``` $ cat tests/tool-debugger/find-artifacts/_ocamltest/tests/tool-debugger/find-artifacts/debuggee/ocamlc.byte/debuggee.byte.output Loading program... done. Breakpoint: 1 10 <|b|>print x; Uncaught exception: Persistent_env.Error(_) ``` After: ``` $ cat tests/tool-debugger/find-artifacts/_ocamltest/tests/tool-debugger/find-artifacts/debuggee/ocamlc.byte/debuggee.byte.output Loading program... done. Breakpoint: 1 10 <|b|>print x; Debugger [version 4.09.0+dev0-2019-01-18] environment error: The files /usr/local/lib/ocaml/stdlib.cmi and [...]_ocamltest/tests/tool-debugger/find-artifacts/debuggee/ocamlc.byte/out/blah.cmi make inconsistent assumptions over interface Stdlib ```master
parent
1211b9cfbe
commit
d5f8a9f948
|
@ -239,6 +239,11 @@ let main () =
|
|||
Env.report_error err_formatter e;
|
||||
eprintf "@]@.";
|
||||
exit 2
|
||||
| Persistent_env.Error e ->
|
||||
eprintf "Debugger [version %s] environment error:@ @[@;" Config.version;
|
||||
Persistent_env.report_error err_formatter e;
|
||||
eprintf "@]@.";
|
||||
exit 2
|
||||
| Cmi_format.Error e ->
|
||||
eprintf "Debugger [version %s] environment error:@ @[@;" Config.version;
|
||||
Cmi_format.report_error err_formatter e;
|
||||
|
|
|
@ -26,6 +26,10 @@ type error =
|
|||
| Need_recursive_types of modname
|
||||
| Depend_on_unsafe_string_unit of modname
|
||||
|
||||
exception Error of error
|
||||
|
||||
val report_error: Format.formatter -> error -> unit
|
||||
|
||||
module Persistent_signature : sig
|
||||
type t =
|
||||
{ filename : string; (** Name of the file containing the signature. *)
|
||||
|
|
Loading…
Reference in New Issue