]> Devoid-pointer.net GitWeb - Nine-Q.git/commitdiff
- Add static error pages to display when template generation fails
authorMichal Malý <madcatxster@devoid-pointer.net>
Sun, 30 Nov 2014 19:32:12 +0000 (20:32 +0100)
committerMichal Malý <madcatxster@devoid-pointer.net>
Sun, 30 Nov 2014 19:32:12 +0000 (20:32 +0100)
- Redirect to index only when problem_category GET parameters is empty

15 files changed:
bin/styles/main.css
bin/templates/error.html [new file with mode: 0644]
bin/templates/static/error_display_answer.html [new file with mode: 0644]
bin/templates/static/error_display_assignment.html [new file with mode: 0644]
bin/templates/static/error_prepare_problem.html [new file with mode: 0644]
bin/templates/static/error_problem_category.html [new file with mode: 0644]
bin/templates/static/error_problem_id.html [new file with mode: 0644]
bin/templates/static/error_uid_registration.html [new file with mode: 0644]
src/face_generators/face_generator.adb
src/face_generators/face_generator.ads
src/handlers/handler_check_answer.adb
src/handlers/handler_next_problem.adb
src/handlers/handler_start.adb
src/problem_manager.adb
src/problem_manager.ads

index 2c0ffb77cf68266cb81d48b82c145900aa839114..889d0fdcd0f880138096d48a5212111ad786df22 100644 (file)
   font-style: italic;
 }
 
+.error_text {
+  font-size: 12pt;
+  margin-left: 32px;
+  margin-right: 32px;
+  margin-bottom: 16px;
+}
+
 .exponent {
   font-size: 75%;
   vertical-align: super;
@@ -117,6 +124,16 @@ a.main_navlink {
   -webkit-border-radius: 4px;
 }
 
+a.default_link {
+  color: inherit;
+  font-weight: bold;
+  text-decoration: none;
+}
+
+a:visited.default_link {
+  color: black;
+}
+
 a:hover.main_navlink {
   background-color: #58acf4;
 }
@@ -137,6 +154,21 @@ a:visited.footer_link {
   text-decoration: none;
 }
 
+div.error_box {
+  background-color: #ff4141;
+  margin-left: 32px;
+  margin-right: 32px;
+  padding-top: 16px;
+  padding-bottom: 16px;
+
+  /* CSS3 only */
+  border-radius: 10px;
+  /* Pre CSS3 Mozilla */
+  -moz-border-radius: 10px;
+  /* Pre CSS3 Webkit */
+  -webkit-border-radius: 10px;
+}
+
 div.hint_block {
   margin-left: 32px;
   margin-right: 32px;
diff --git a/bin/templates/error.html b/bin/templates/error.html
new file mode 100644 (file)
index 0000000..eac1f32
--- /dev/null
@@ -0,0 +1,5 @@
+    <div class="error_box">
+      <div class="caption_v1">Something didn't go quite as it was supposed to. We're sorry about this.</div>
+      <div class="error_text">@_ERROR_MESSAGE_@</div>
+      <div class="error_text">You can report the problem to the <a class="default_link" href="mailto:webmaster-nineq@devoid-pointer.net">webmaster</a>.</div>
+    </div>
diff --git a/bin/templates/static/error_display_answer.html b/bin/templates/static/error_display_answer.html
new file mode 100644 (file)
index 0000000..e97b127
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
+
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+  <meta http-equiv="content-language" content="cs" />
+  @_META_EXPIRE_NOW_@
+  @_META_NO_CACHE_@
+  <link rel="stylesheet" type="text/css" href="/main_stylesheet" /> 
+  <title>TGen_Prototype</title>
+</head>
+
+<body>
+  <div id="container">
+    <div id="page_caption">
+      <div id="page_caption_text"><a class="back_link" href="/">Oops...</a></div>
+    </div>
+    <div id="content">
+
+    <div class="error_box">
+      <div class="caption_v1">Something didn't go quite as it was supposed to. We're sorry about this.</div>
+      <div class="error_text">Cannot display answer.</div>
+      <div class="error_text">You can report the problem to the <a class="default_link" href="mailto:webmaster-nineq@devoid-pointer.net">webmaster</a>.</div>
+    </div>
+
+    </div>
+    <div id="spacer"></div>
+    <div id="footer">
+      <span id="core_info">Powered by: <a class="footer_link" href="http://libre.adacore.com/tools/aws/">AWS</a> | <a class="footer_link" href="http://gitweb.devoid-pointer.net/?p=Nine-Q.git;a=summary">Nine-Q</a></span>
+    </div>
+  </div>
+</body>
+
+</html>
diff --git a/bin/templates/static/error_display_assignment.html b/bin/templates/static/error_display_assignment.html
new file mode 100644 (file)
index 0000000..21365a4
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
+
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+  <meta http-equiv="content-language" content="cs" />
+  @_META_EXPIRE_NOW_@
+  @_META_NO_CACHE_@
+  <link rel="stylesheet" type="text/css" href="/main_stylesheet" /> 
+  <title>TGen_Prototype</title>
+</head>
+
+<body>
+  <div id="container">
+    <div id="page_caption">
+      <div id="page_caption_text"><a class="back_link" href="/">Oops...</a></div>
+    </div>
+    <div id="content">
+
+    <div class="error_box">
+      <div class="caption_v1">Something didn't go quite as it was supposed to. We're sorry about this.</div>
+      <div class="error_text">Cannot display assignment.</div>
+      <div class="error_text">You can report the problem to the <a class="default_link" href="mailto:webmaster-nineq@devoid-pointer.net">webmaster</a>.</div>
+    </div>
+
+    </div>
+    <div id="spacer"></div>
+    <div id="footer">
+      <span id="core_info">Powered by: <a class="footer_link" href="http://libre.adacore.com/tools/aws/">AWS</a> | <a class="footer_link" href="http://gitweb.devoid-pointer.net/?p=Nine-Q.git;a=summary">Nine-Q</a></span>
+    </div>
+  </div>
+</body>
+
+</html>
diff --git a/bin/templates/static/error_prepare_problem.html b/bin/templates/static/error_prepare_problem.html
new file mode 100644 (file)
index 0000000..1244e32
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
+
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+  <meta http-equiv="content-language" content="cs" />
+  @_META_EXPIRE_NOW_@
+  @_META_NO_CACHE_@
+  <link rel="stylesheet" type="text/css" href="/main_stylesheet" /> 
+  <title>TGen_Prototype</title>
+</head>
+
+<body>
+  <div id="container">
+    <div id="page_caption">
+      <div id="page_caption_text"><a class="back_link" href="/">Oops...</a></div>
+    </div>
+    <div id="content">
+
+    <div class="error_box">
+      <div class="caption_v1">Something didn't go quite as it was supposed to. We're sorry about this.</div>
+      <div class="error_text">Cannot prepare problem.</div>
+      <div class="error_text">You can report the problem to the <a class="default_link" href="mailto:webmaster-nineq@devoid-pointer.net">webmaster</a>.</div>
+    </div>
+
+    </div>
+    <div id="spacer"></div>
+    <div id="footer">
+      <span id="core_info">Powered by: <a class="footer_link" href="http://libre.adacore.com/tools/aws/">AWS</a> | <a class="footer_link" href="http://gitweb.devoid-pointer.net/?p=Nine-Q.git;a=summary">Nine-Q</a></span>
+    </div>
+  </div>
+</body>
+
+</html>
diff --git a/bin/templates/static/error_problem_category.html b/bin/templates/static/error_problem_category.html
new file mode 100644 (file)
index 0000000..2210513
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
+
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+  <meta http-equiv="content-language" content="cs" />
+  @_META_EXPIRE_NOW_@
+  @_META_NO_CACHE_@
+  <link rel="stylesheet" type="text/css" href="/main_stylesheet" /> 
+  <title>TGen_Prototype</title>
+</head>
+
+<body>
+  <div id="container">
+    <div id="page_caption">
+      <div id="page_caption_text"><a class="back_link" href="/">Oops...</a></div>
+    </div>
+    <div id="content">
+
+    <div class="error_box">
+      <div class="caption_v1">Something didn't go quite as it was supposed to. We're sorry about this.</div>
+      <div class="error_text">Problem category is missing.</div>
+      <div class="error_text">You can report the problem to the <a class="default_link" href="mailto:webmaster-nineq@devoid-pointer.net">webmaster</a>.</div>
+    </div>
+
+    </div>
+    <div id="spacer"></div>
+    <div id="footer">
+      <span id="core_info">Powered by: <a class="footer_link" href="http://libre.adacore.com/tools/aws/">AWS</a> | <a class="footer_link" href="http://gitweb.devoid-pointer.net/?p=Nine-Q.git;a=summary">Nine-Q</a></span>
+    </div>
+  </div>
+</body>
+
+</html>
diff --git a/bin/templates/static/error_problem_id.html b/bin/templates/static/error_problem_id.html
new file mode 100644 (file)
index 0000000..fdba946
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
+
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+  <meta http-equiv="content-language" content="cs" />
+  @_META_EXPIRE_NOW_@
+  @_META_NO_CACHE_@
+  <link rel="stylesheet" type="text/css" href="/main_stylesheet" /> 
+  <title>TGen_Prototype</title>
+</head>
+
+<body>
+  <div id="container">
+    <div id="page_caption">
+      <div id="page_caption_text"><a class="back_link" href="/">Oops...</a></div>
+    </div>
+    <div id="content">
+
+    <div class="error_box">
+      <div class="caption_v1">Something didn't go quite as it was supposed to. We're sorry about this.</div>
+      <div class="error_text">Problem ID not present.</div>
+      <div class="error_text">You can report the problem to the <a class="default_link" href="mailto:webmaster-nineq@devoid-pointer.net">webmaster</a>.</div>
+    </div>
+
+    </div>
+    <div id="spacer"></div>
+    <div id="footer">
+      <span id="core_info">Powered by: <a class="footer_link" href="http://libre.adacore.com/tools/aws/">AWS</a> | <a class="footer_link" href="http://gitweb.devoid-pointer.net/?p=Nine-Q.git;a=summary">Nine-Q</a></span>
+    </div>
+  </div>
+</body>
+
+</html>
diff --git a/bin/templates/static/error_uid_registration.html b/bin/templates/static/error_uid_registration.html
new file mode 100644 (file)
index 0000000..3431246
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
+
+<head>
+  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+  <meta http-equiv="content-language" content="cs" />
+  @_META_EXPIRE_NOW_@
+  @_META_NO_CACHE_@
+  <link rel="stylesheet" type="text/css" href="/main_stylesheet" /> 
+  <title>TGen_Prototype</title>
+</head>
+
+<body>
+  <div id="container">
+    <div id="page_caption">
+      <div id="page_caption_text"><a class="back_link" href="/">Oops...</a></div>
+    </div>
+    <div id="content">
+
+    <div class="error_box">
+      <div class="caption_v1">Something didn't go quite as it was supposed to. We're sorry about this.</div>
+      <div class="error_text">Cannot register UID.</div>
+      <div class="error_text">You can report the problem to the <a class="default_link" href="mailto:webmaster-nineq@devoid-pointer.net">webmaster</a>.</div>
+    </div>
+
+    </div>
+    <div id="spacer"></div>
+    <div id="footer">
+      <span id="core_info">Powered by: <a class="footer_link" href="http://libre.adacore.com/tools/aws/">AWS</a> | <a class="footer_link" href="http://gitweb.devoid-pointer.net/?p=Nine-Q.git;a=summary">Nine-Q</a></span>
+    </div>
+  </div>
+</body>
+
+</html>
index f95104b50a28b3912478fe754a43174150fa65fc..41f47c8624805a6dc11fe8d9f8406949a0c28212 100644 (file)
@@ -2,6 +2,26 @@ with Ada.Strings.Unbounded;
 
 package body Face_Generator is
 
+  function Generate_Error_Face(HTML: out HTML_Code; Message: in String) return RetCode is
+    use AWS.Templates;
+
+    Temp: HTML_Code;
+    Translations_Hdr: Translate_Set;
+    Translations: Translate_Set;
+  begin
+    Insert(Translations_Hdr, Assoc(HEADER_CAPTION_KEY, "Oops..."));
+    HTML := Parse(Filename => "templates/header.html", Translations => Translations_Hdr);
+
+    Insert(Translations, Assoc(ERROR_MESSAGE_KEY, Message));
+    Temp := Parse(Filename => "templates/error.html", Translations => Translations);
+    Append_HTML(Source => HTML, New_Item => Temp);
+
+    Temp := Parse(Filename => "templates/footer.html");
+    Append_HTML(Source => HTML, New_Item => Temp);
+
+    return OK;
+  end Generate_Error_Face;
+
   function Generate_Index_Face(HTML: out HTML_Code) return RetCode is
     use AWS.Templates;
 
index 894a392a68ea62beced07b17e544649f7e12936d..5e546d06a543d3a7d012e6804fdcb270250fce90 100644 (file)
@@ -4,8 +4,8 @@ with AWS.Templates;
 
 use Global_Types;
 package Face_Generator is
+  function Generate_Error_Face(HTML: out HTML_Code; Message: in String) return RetCode;
   function Generate_Index_Face(HTML: out HTML_Code) return RetCode;
-
   function Generate_Face(Assignment: in Problem_Generator_Syswides.Assignment_Info.Map;
                         Parameters: in Problem_Generator_Syswides.Parameters_Info.Map;
                         HTML: out HTML_Code;
@@ -36,6 +36,7 @@ private
                                    HTML: out HTML_Code;
                                    Pr_ID: in String; Pr_Cat: in String) return RetCode;
 
+  ERROR_MESSAGE_KEY: constant String := "ERROR_MESSAGE";
   HEADER_CAPTION_KEY: constant String := "HEADER_CAPTION";
   HINTS_SECTION_KEY: constant String := "HINTS_SECTION";
   META_EXPIRE_NOW_KEY: constant String := "META_EXPIRE_NOW";
index 95b22f87b0a7cbf88d693c292d8699ccaa0b6611..bfd9ab077debf63eb64cdc48c31f9224a96d0126 100644 (file)
@@ -6,12 +6,11 @@ with AWS.Response;
 with AWS.Session;
 with AWS.Status;
 
+with Face_Generator_Static;
 with Global_Types;
 with Problem_Manager;
 with Problem_Generator_Syswides;
 
-with Ada.Text_IO;
-
 use Global_Types;
 package body Handler_Check_Answer is
 
@@ -38,9 +37,7 @@ package body Handler_Check_Answer is
          -- Get UID
          Success := Problem_Manager.Get_UID(Raw_UID, UID);
          if Success = False then
-           -- UID could not have been registered
-           -- TODO: Print some sensible error message, for now just redirect to index
-           Ada.Text_IO.Put_Line("UID has not been registered: " & Raw_UID);
+           -- This UID is invalid, redirect to index
            return AWS.Response.URL(Location => "/");
          end if;
 
@@ -57,22 +54,25 @@ package body Handler_Check_Answer is
 
          -- Get problem ID
          if Answer.Find(Problem_Generator_Syswides.RESERVED_PROBLEM_ID_KEY) = Answer_Info.No_Element then
-           Ada.Text_IO.Put_Line("Problem ID not found!");
-           return AWS.Response.URL(Location => "/");
+           return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
+                                     Message_Body => HTML_To_Fixed_String(Face_Generator_Static.Error_Problem_ID),
+                                     Status_Code => AWS.Messages.S200);
          end if;
 
          begin
            Pr_ID := Problem_ID'Value(Answer.Element(Problem_Generator_Syswides.RESERVED_PROBLEM_ID_KEY));
          exception
            when Constraint_Error =>
-             Ada.Text_IO.Put_Line("Invalid problem ID value");
-             return AWS.Response.URL(Location => "/");
+             return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
+                                       Message_Body => HTML_To_Fixed_String(Face_Generator_Static.Error_Problem_ID),
+                                       Status_Code => AWS.Messages.S200);
          end;
 
         Ret := Problem_Manager.Display_Checked_Answer(UID, Answer, HTML, Pr_ID);
          if Ret /= OK then
-           Ada.Text_IO.Put_Line("No such problem in storage");
-           return AWS.Response.URL(Location => "/");
+           return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
+                                     Message_Body => HTML_To_Fixed_String(Face_Generator_Static.Error_Display_Answer),
+                                     Status_Code => AWS.Messages.S200);
          end if;
 
          return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
@@ -80,7 +80,6 @@ package body Handler_Check_Answer is
                                    Status_Code => AWS.Messages.S200);
        end;
       when others =>
-       Ada.Text_IO.Put_Line("Invalid request");
        return AWS.Response.URL(Location => "/");
     end case;
   end Handle;
index 1ddbd19b1a33f054b51c2625df9621a30909db32..aa7407fb9914d518be738a1e86831d2434086533 100644 (file)
@@ -8,6 +8,7 @@ with AWS.Status;
 
 with Ada.Text_IO;
 
+with Face_Generator_Static;
 with Global_Types;
 with Problem_Generator_Syswides;
 with Problem_Manager;
@@ -38,8 +39,7 @@ package body Handler_Next_Problem is
          -- Get UID
          Success := Problem_Manager.Get_UID(Raw_UID, UID);
          if Success = False then
-           -- UID could not have been registered
-           -- TODO: Print some sensible error message, for now just redirect to index
+           -- This UID is invalid, redirect to index
            return AWS.Response.URL(Location => "/");
          end if;
 
@@ -57,8 +57,9 @@ package body Handler_Next_Problem is
 
          -- Create a new problem
          if Problem_Parameters.Find(Problem_Generator_Syswides.RESERVED_PROBLEM_CATEGORY_KEY) = Parameters_Info.No_Element then
-           Ada.Text_IO.Put_Line("No problem category tag");
-           return AWS.Response.URL(Location => "/");
+           return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
+                                     Message_Body => HTML_To_Fixed_String(Face_Generator_Static.Error_Problem_Category),
+                                     Status_Code => AWS.Messages.S200);
          end if;
 
          declare
@@ -66,14 +67,16 @@ package body Handler_Next_Problem is
          begin
            Ret := Problem_Manager.Prepare_Problem(UID, Raw_P_Cat, Problem_Parameters);
            if Ret /= OK then
-             -- TODO: Handle error in a less reckless manner
-             return AWS.Response.URL(Location => "/");
+             return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
+                                       Message_Body => HTML_To_Fixed_String(Face_Generator_Static.Error_Prepare_Problem),
+                                       Status_Code => AWS.Messages.S200);
            end if;
            -- Display new problem
            Ret := Problem_Manager.Display_Assignment(UID, HTML);
            if Ret /= OK then
-             -- TODO: Handle error in a less reckless manner
-             return AWS.Response.URL(Location => "/");
+             return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
+                                       Message_Body => HTML_To_Fixed_String(Face_Generator_Static.Error_Display_Assignment),
+                                       Status_Code => AWS.Messages.S200);
            end if;
 
            return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
index 6cbea1b1b4f2c7bc89ad357dd0a04b0f7884e421..2e614055da31303e4eea28c018c2f30de8f68765 100644 (file)
@@ -3,11 +3,10 @@ with AWS.MIME;
 with AWS.Response;
 with AWS.Session;
 with AWS.Status;
+with Face_Generator_Static;
 with Global_Types;
 with Problem_Manager;
 
---with Ada.Text_IO;
-
 use Global_Types;
 package body Handler_Start is
 
@@ -26,7 +25,12 @@ package body Handler_Start is
          UID: Unique_ID;
          Ret: RetCode;
          Success: Boolean;
-       begin   
+       begin
+         -- Check that the problem category is not empty
+         if Raw_Problem_Category'Length = 0 then
+           return AWS.Response.URL(Location => "/");       
+         end if;
+
          -- Register new UID if necessary and create a first problem
          Success := Problem_Manager.Get_UID(Raw_UID, UID);
          if Success = False then
@@ -35,7 +39,9 @@ package body Handler_Start is
            if Ret /= OK then
              -- UID could not have been registered
              -- TODO: Print some sensible error message, for now just redirect to index
-             return AWS.Response.URL(Location => "/");
+             return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
+                                       Message_Body => HTML_To_Fixed_String(Face_Generator_Static.Error_UID_Registration),
+                                       Status_Code => AWS.Messages.S200);
            end if;
            -- Save the new UID
            AWS.Session.Set(SID, "UID", Unique_ID'Image(UID));
@@ -47,12 +53,16 @@ package body Handler_Start is
          if Ret /= OK then
            -- Something went wrong when generating the problem
            -- TODO: Print some sensible error message, for now just redirect to index
-           return AWS.Response.URL(Location => "/");
+           return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
+                                     Message_Body => HTML_To_Fixed_String(Face_Generator_Static.Error_Prepare_Problem),
+                                     Status_Code => AWS.Messages.S200);
          end if;
 
          Ret := Problem_Manager.Display_Assignment(UID, HTML);
          if Ret /= OK then
-           HTML := To_HTML_Code("Cannot display assignment");
+           return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
+                                     Message_Body => HTML_To_Fixed_String(Face_Generator_Static.Error_Display_Assignment),
+                                     Status_Code => AWS.Messages.S200);
          end if;
          return AWS.Response.Build(Content_Type => AWS.MIME.Text_HTML,
                                    Message_Body => HTML_To_Fixed_String(HTML),
index d4f6f1f00b41940f24ae632eda8905ea859f9f7a..7457b7a3bc17b1cd0114a339ac6701284e4222a0 100644 (file)
@@ -21,17 +21,18 @@ package body Problem_Manager is
     Ret := Stored.Problem.Get_Parameters(Parameters);
     if Ret /= OK then
       Stored.Mutex.Unlock;
-      return Ret;
+      return Face_Generator.Generate_Error_Face(HTML, ERRMSG_GET_PARAMETERS & " (" & RetCode'Image(Ret) & ")");
     end if;
 
     begin
       Ret := Stored.Problem.Get_Assignment(Assignment);
       if Ret /= OK then
        Stored.Mutex.Unlock;
-       return Ret;
+       return Face_Generator.Generate_Error_Face(HTML, ERRMSG_GET_ASSIGNMENT & " (" & RetCode'Image(Ret) & ")");
       end if;
     exception
       when others =>
+       return Face_Generator.Generate_Error_Face(HTML, ERRMSG_UNHANDLED_EXCEPTION);
        Stored.Mutex.Unlock;
        return E_UNKW;
     end;
@@ -60,7 +61,7 @@ package body Problem_Manager is
     Ret := Stored.Problem.Get_Parameters(Parameters);
     if Ret /= OK then
       Stored.Mutex.Unlock;
-      return Ret;
+      return Face_Generator.Generate_Error_Face(HTML, ERRMSG_GET_PARAMETERS & " (" & RetCode'Image(Ret) & ")");
     end if;
 
     -- Get assignment
@@ -68,12 +69,12 @@ package body Problem_Manager is
       Ret := Stored.Problem.Get_Assignment(Assignment);
       if Ret /= OK then
        Stored.Mutex.Unlock;
-       return Ret;
+       return Face_Generator.Generate_Error_Face(HTML, ERRMSG_GET_ASSIGNMENT & " (" & RetCode'Image(Ret) & ")");
       end if;
     exception
       when others =>
        Stored.Mutex.Unlock;
-       return E_UNKW;
+       return Face_Generator.Generate_Error_Face(HTML, ERRMSG_UNHANDLED_EXCEPTION);
     end;
 
     Pr_Cat := Stored.Category;
index 5fccf1e9d2f24ff5a141bca2e2714684f1f3d98d..ab460e9c8df1a5740c0b4e7bd05845a0e7958d09 100644 (file)
@@ -43,6 +43,10 @@ private
     end record;
   type User_Session_All_Access is access all User_Session_Data;
 
+  ERRMSG_GET_ASSIGNMENT: constant String := "Unable to get assignment";
+  ERRMSG_GET_PARAMETERS: constant String := "Unable to get problem parameters";
+  ERRMSG_UNHANDLED_EXCEPTION: constant String := "Unhandled exception occured";
+  
   package Session_Keeping is new Ada.Containers.Ordered_Maps(Key_Type => Unique_ID, Element_Type => User_Session_All_Access);
 
   protected Active_Sessions is