]> Devoid-pointer.net GitWeb - Nine-Q.git/commitdiff
Catch unhandled exceptions that might occur in Check_Answer
authorMichal Malý <madcatxster@devoid-pointer.net>
Tue, 23 Dec 2014 18:40:37 +0000 (19:40 +0100)
committerMichal Malý <madcatxster@devoid-pointer.net>
Tue, 23 Dec 2014 18:40:37 +0000 (19:40 +0100)
src/problem_manager.adb

index 0fb92e0d4716f26907cb1a110e4f382780783d1a..213bc53ed405f1768c99538a7f501e4b3357bffb 100644 (file)
@@ -42,7 +42,14 @@ package body Problem_Manager is
        return Face_Generator.Generate_Error_Face(HTML, ERRMSG_UNHANDLED_EXCEPTION & " (" & Ada.Exceptions.Exception_Information(Ex) & ")");
     end;
 
-    ARC := Stored.Problem.Check_Answer(Answer, Answer_Message);
+    begin
+      ARC := Stored.Problem.Check_Answer(Answer, Answer_Message);
+    exception
+      when Ex: others =>
+       Stored.Mutex.Unlock;
+       Logging_System.Log(ERRMSG_UNHANDLED_EXCEPTION & " (" & Ada.Exceptions.Exception_Information(Ex) & ")", Logging_System.ERROR);
+       return Face_Generator.Generate_Error_Face(HTML, ERRMSG_UNHANDLED_EXCEPTION & " (" & Ada.Exceptions.Exception_Information(Ex) & ")");
+    end;
     Stored.Mutex.Unlock;
     return Face_Generator.Generate_Face_With_Answer(Assignment => Assignment, Answer_Message => Answer_Message,
                                                    Answer_Code => ARC, HTML => HTML,