Add last-resort exception handlers in server code
authorAdam Chlipala <adamc@hcoop.net>
Mon, 9 Apr 2007 22:07:25 +0000 (22:07 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Mon, 9 Apr 2007 22:07:25 +0000 (22:07 +0000)
src/main.sml

index 0be3112..84e7fe3 100644 (file)
@@ -847,6 +847,7 @@ fun regenerate context =
                handle IO.Io _ => ()
                     | OS.SysErr (s, _) => print ("System error processing user " ^ user ^ ": " ^ s ^ "\n")
                     | ErrorMsg.Error => print ("User " ^ user ^ " had a compilation error.\n")
                handle IO.Io _ => ()
                     | OS.SysErr (s, _) => print ("System error processing user " ^ user ^ ": " ^ s ^ "\n")
                     | ErrorMsg.Error => print ("User " ^ user ^ " had a compilation error.\n")
+                    | _ => print "Unknown exception during regeneration!\n"
     in
        app contactNode Config.nodeIps;
        Env.pre ();
     in
        app contactNode Config.nodeIps;
        Env.pre ();
@@ -1252,6 +1253,11 @@ fun service () =
                            OpenSSL.close bio
                            handle OpenSSL.OpenSSL _ => ();
                            loop ())
                            OpenSSL.close bio
                            handle OpenSSL.OpenSSL _ => ();
                            loop ())
+                        | _ =>
+                          (print "Unknown exception in main loop!\n";
+                           OpenSSL.close bio
+                           handle OpenSSL.OpenSSL _ => ();
+                           loop ())
     in
        print ("Domtool dispatcher starting up at " ^ now () ^ "\n");
        print "Listening for connections....\n";
     in
        print ("Domtool dispatcher starting up at " ^ now () ^ "\n");
        print "Listening for connections....\n";