Template language overhaul & misc. improvements
[bpt/mlt.git] / src / lib / main.sml
index 0533912..b058cce 100644 (file)
@@ -27,7 +27,7 @@ struct
        let
            val _ = Cgi.init ()
            val cgiFields = Cgi.cgi_fieldnames ()
-           fun mapper name = (name, valOf (Cgi.cgi_field_string name))
+           fun mapper name = (name, Cgi.cgi_field_strings name)
        in
            Web.pushParams (map mapper cgiFields);
            case args of
@@ -40,7 +40,10 @@ struct
                   | SOME f => (f ();
                                Web.output ();
                                OS.Process.success))
-       end handle ex => (print "Status: 500\nContent-type: text/plain\n\nAn exception!\n\n";
+       end handle Fail msg => (print "Status: 500\nContent-type: text/plain\n\nFatal error: \n\n";
+                               print msg;
+                               OS.Process.failure)
+                | ex => (print "Status: 500\nContent-type: text/plain\n\nAn exception!\n\n";
                          app (fn s => print (s ^ "\n")) (SMLofNJ.exnHistory ex);
                          OS.Process.failure)
 end
\ No newline at end of file