@@ -17,6 +17,10 @@ let is_success = function
17
17
| Toploop_ext. Ok _ -> true
18
18
| Toploop_ext. Error _ -> false
19
19
20
+ let success_string = function
21
+ | Toploop_ext. Ok _ -> " OK"
22
+ | Toploop_ext. Error (((_ , e ),_ ),_ ) -> " Error: " ^ e
23
+
20
24
type 'a return =
21
25
| ReturnSuccess of 'a * Toploop_ext .warning list
22
26
| ReturnError of Toploop_ext .error * Toploop_ext .warning list
@@ -166,7 +170,8 @@ let handler : type a. a host_msg -> a return Lwt.t = function
166
170
let ppf_answer = make_answer_ppf fd_answer in
167
171
if ! debug then Js_utils. debug " Worker: -> Execute (%S)" code;
168
172
let result = Toploop_ext. execute ?ppf_code ~print_outcome ~ppf_answer code in
169
- if ! debug then Js_utils. debug " Worker: <- Execute (%B)" (is_success result);
173
+ if ! debug then
174
+ Js_utils. debug " Worker: <- Execute (%s)" (success_string result);
170
175
iter_option close_fd fd_code;
171
176
close_fd fd_answer;
172
177
unwrap_result result
@@ -178,10 +183,11 @@ let handler : type a. a host_msg -> a return Lwt.t = function
178
183
try Toploop_jsoo. use_compiled_string js_code; Toploop_ext. Ok (true , [] )
179
184
with exn ->
180
185
Firebug. console##log (Js. string (Printexc. to_string exn ));
181
- Format. fprintf ppf_answer " %s" (Printexc. to_string exn ); Toploop_ext. Ok (false , [] )
186
+ Format. fprintf ppf_answer " %s" (Printexc. to_string exn );
187
+ Toploop_ext. Ok (false , [] )
182
188
in
183
189
if ! debug then
184
- Js_utils. debug " Worker: <- Use_js_string (%B )" (is_success result);
190
+ Js_utils. debug " Worker: <- Use_js_string (%s )" (success_string result);
185
191
close_fd fd_answer;
186
192
unwrap_result result
187
193
| Use_string (filename , print_outcome , fd_answer , code ) ->
@@ -190,7 +196,7 @@ let handler : type a. a host_msg -> a return Lwt.t = function
190
196
Js_utils. debug " Worker: -> Use_string (%S)" code;
191
197
let result = Toploop_ext. use_string ?filename ~print_outcome ~ppf_answer code in
192
198
if ! debug then
193
- Js_utils. debug " Worker: <- Use_string (%B )" (is_success result);
199
+ Js_utils. debug " Worker: <- Use_string (%s )" (success_string result);
194
200
close_fd fd_answer;
195
201
unwrap_result result
196
202
| Use_mod_string (fd_answer , print_outcome , modname , sig_code , impl_code ) ->
@@ -202,7 +208,7 @@ let handler : type a. a host_msg -> a return Lwt.t = function
202
208
~ppf_answer ~print_outcome ~modname ?sig_code impl_code in
203
209
if ! debug then
204
210
Js_utils. debug
205
- " Worker: <- Use_mod_string %s (%B )" modname (is_success result);
211
+ " Worker: <- Use_mod_string %s (%s )" modname (success_string result);
206
212
close_fd fd_answer;
207
213
unwrap_result result
208
214
| Set_debug b ->
0 commit comments