equal
deleted
inserted
replaced
260 | raised name msgs = cat_lines (("exception " ^ name ^ " raised:") :: msgs); |
260 | raised name msgs = cat_lines (("exception " ^ name ^ " raised:") :: msgs); |
261 |
261 |
262 fun exn_msg _ TERMINATE = "Exit." |
262 fun exn_msg _ TERMINATE = "Exit." |
263 | exn_msg _ RESTART = "Restart." |
263 | exn_msg _ RESTART = "Restart." |
264 | exn_msg _ Interrupt = "Interrupt." |
264 | exn_msg _ Interrupt = "Interrupt." |
|
265 | exn_msg _ TimeLimit.TimeOut = "Timeout." |
265 | exn_msg _ TOPLEVEL_ERROR = "Error." |
266 | exn_msg _ TOPLEVEL_ERROR = "Error." |
266 | exn_msg _ (SYS_ERROR msg) = "## SYSTEM ERROR ##\n" ^ msg |
267 | exn_msg _ (SYS_ERROR msg) = "## SYSTEM ERROR ##\n" ^ msg |
267 | exn_msg _ (ERROR msg) = msg |
268 | exn_msg _ (ERROR msg) = msg |
268 | exn_msg detailed (Exn.EXCEPTIONS (exns, "")) = cat_lines (map (exn_msg detailed) exns) |
269 | exn_msg detailed (Exn.EXCEPTIONS (exns, "")) = cat_lines (map (exn_msg detailed) exns) |
269 | exn_msg detailed (Exn.EXCEPTIONS (exns, msg)) = cat_lines (map (exn_msg detailed) exns @ [msg]) |
270 | exn_msg detailed (Exn.EXCEPTIONS (exns, msg)) = cat_lines (map (exn_msg detailed) exns @ [msg]) |
303 |
304 |
304 fun debugging f x = |
305 fun debugging f x = |
305 if ! debug then exception_trace (fn () => f x) |
306 if ! debug then exception_trace (fn () => f x) |
306 else f x; |
307 else f x; |
307 |
308 |
308 fun interruptible f x = |
|
309 let val y = ref NONE |
|
310 in raise_interrupt (fn () => y := SOME (f x)) (); the (! y) end; |
|
311 |
|
312 fun toplevel_error f x = f x |
309 fun toplevel_error f x = f x |
313 handle exn => (Output.error_msg (exn_message exn); raise TOPLEVEL_ERROR); |
310 handle exn => (Output.error_msg (exn_message exn); raise TOPLEVEL_ERROR); |
314 |
311 |
315 in |
312 in |
316 |
313 |
769 raw_loop secure src) |
766 raw_loop secure src) |
770 end; |
767 end; |
771 |
768 |
772 in |
769 in |
773 |
770 |
774 fun loop secure src = ignore_interrupt (raw_loop secure) src; |
771 fun loop secure src = uninterruptible (fn _ => raw_loop secure) src; |
775 |
772 |
776 end; |
773 end; |
777 |
774 |
778 end; |
775 end; |