File tree 2 files changed +13
-2
lines changed
2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -104,14 +104,23 @@ module Handshake = struct
104
104
prerr_endline " Unexpected value after handshake." ;
105
105
exit 1
106
106
107
+ exception Error of string
108
+
109
+ let () =
110
+ Printexc. register_printer (function
111
+ | Error msg ->
112
+ Some (Printf. sprintf " Extend_main.Handshake.Error %S" msg)
113
+ | _ -> None
114
+ )
115
+
107
116
let negotiate_driver ext_name i o =
108
117
let magic' = really_input_string i (String. length magic_number) in
109
118
if magic' <> magic_number then (
110
119
let msg = Printf. sprintf
111
120
" Extension %s has incompatible protocol version %S (expected %S)"
112
121
ext_name magic' magic_number
113
122
in
114
- failwith msg
123
+ raise ( Error msg)
115
124
);
116
125
let versions' : versions = input_value i in
117
126
let check_v prj name =
@@ -120,7 +129,7 @@ module Handshake = struct
120
129
" Extension %s %s has incompatible version %S (expected %S)"
121
130
ext_name name (prj versions') (prj versions)
122
131
in
123
- failwith msg
132
+ raise ( Error msg)
124
133
in
125
134
check_v (fun x -> x.ast_impl_magic_number) " implementation AST" ;
126
135
check_v (fun x -> x.ast_intf_magic_number) " interface AST" ;
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ module Handshake : sig
25
25
cmt_magic_number : string ;
26
26
}
27
27
28
+ exception Error of string
29
+
28
30
val versions : versions
29
31
30
32
val negotiate_driver : string -> in_channel -> out_channel -> capabilities
You can’t perform that action at this time.
0 commit comments