- 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);
+ end handle ex => (Web.setExn ex;
+ Web.clear ();
+ Templates.exnFn ();
+ if Web.noOutput () then
+ (print "Status: 500\nContent-type: text/plain\n\nAn exception!\n\n";
+ app (fn s => print (s ^ "\n")) (SMLofNJ.exnHistory ex))
+ else
+ Web.output ();