From 4e62d6ab7d49de0727b085f93575eadddd063ba8 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Fri, 15 Apr 2005 17:11:38 +0000 Subject: [PATCH] Better reporting of cascading exceptions --- src/lib/main.sml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lib/main.sml b/src/lib/main.sml index 139686a..9ffaf5c 100644 --- a/src/lib/main.sml +++ b/src/lib/main.sml @@ -45,11 +45,15 @@ struct OS.Process.success)) 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 (); + (Templates.exnFn (); + if Web.noOutput () then + (print "Status: 500\nContent-type: text/plain\n\nUncaught exception:\n\n"; + app (fn s => print (s ^ "\n")) (SMLofNJ.exnHistory ex)) + else + Web.output ()) + handle ex' => (print "Status: 500\nContent-type : text/plain\n\nUncaught exception:\n\n"; + app (fn s => print ("\t" ^ s ^ "\n")) (SMLofNJ.exnHistory ex); + print "\nAnother exception raised in exception handler:\n\n"; + app (fn s => print ("\t" ^ s ^ "\n")) (SMLofNJ.exnHistory ex')); OS.Process.failure) end \ No newline at end of file -- 2.20.1