From 7cf605360d59466490c6fb257ea3785c8b426954 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sun, 9 Dec 2007 13:25:40 +0000 Subject: [PATCH] Slave catches all exceptions, to avoid dying --- src/main.sml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.sml b/src/main.sml index ba60764..feaab16 100644 --- a/src/main.sml +++ b/src/main.sml @@ -1636,7 +1636,7 @@ fun slave () = | _ => (OpenSSL.close bio; loop ()) end handle OpenSSL.OpenSSL s => - (print ("OpenSSL error: "^ s ^ "\n"); + (print ("OpenSSL error: " ^ s ^ "\n"); OpenSSL.close bio handle OpenSSL.OpenSSL _ => (); loop ()) @@ -1646,6 +1646,17 @@ fun slave () = OpenSSL.close bio handle OpenSSL.OpenSSL _ => (); loop ()) + | IO.Io {function, name, ...} => + (print ("IO error: " ^ function ^ ": " ^ name ^ "\n"); + OpenSSL.close bio + handle OpenSSL.OpenSSL _ => (); + loop ()) + | e => + (app (fn s => print (s ^ "\n")) (SMLofNJ.exnHistory e); + print "Uncaught exception!\n"; + OpenSSL.close bio + handle OpenSSL.OpenSSL _ => (); + loop ()) in loop (); OpenSSL.shutdown sock -- 2.20.1