Catch-all aliases working again
[hcoop/domtool2.git] / src / main.sml
index fc8df17..feaab16 100644 (file)
@@ -176,7 +176,7 @@ fun eval fname =
            raise ErrorMsg.Error
        else
            Eval.exec (Defaults.eInit ()) body'
-      | NONE => raise ErrorMsg.Error
+      | NONE => ()
 
 fun eval' fname =
     case reduce fname of
@@ -185,7 +185,7 @@ fun eval' fname =
            raise ErrorMsg.Error
        else
            ignore (Eval.exec' (Defaults.eInit ()) body')
-      | NONE => raise ErrorMsg.Error
+      | NONE => ()
 
 val dispatcher =
     Config.dispatcher ^ ":" ^ Int.toString Config.dispatcherPort
@@ -288,7 +288,7 @@ fun requestDir dname =
        val (_, files) = Order.order (SOME b) files
 
        val _ = if !ErrorMsg.anyErrors then
-                   raise ErrorMsg.Error
+                   (print "J\n";raise ErrorMsg.Error)
                else
                    ()
 
@@ -939,7 +939,13 @@ fun domainList dname =
 
 fun regenerateEither tc checker context =
     let
-       val domainsBefore = domainList Config.resultRoot
+       val () = print "Starting regeneration....\n"
+
+       val domainsBefore =
+           if tc then
+               SS.empty
+           else
+               domainList Config.resultRoot
 
        fun ifReal f =
            if tc then
@@ -1015,7 +1021,8 @@ fun regenerateEither tc checker context =
                             print ("User " ^ user ^ "'s configuration has errors!\n");
                             ok := false)
                        else
-                           app checker files
+                           ();
+                       app checker files
                    end
                else
                    ()
@@ -1629,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 ())
@@ -1639,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