Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim/try
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16947/maple/aim/try
Modified Files:
Tag: aim-xml
Question.mpl Quiz.mpl
Log Message:
Many small changes, especially to error handling
Index: Question.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/try/Question.mpl,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -d -r1.5 -r1.5.2.1
*** Question.mpl 16 Sep 2003 20:22:01 -0000 1.5
--- Question.mpl 31 Mar 2005 12:38:15 -0000 1.5.2.1
***************
*** 12,17 ****
):
- `Package/Dependencies` := [];
-
######################################################################
--- 12,15 ----
***************
*** 162,170 ****
quiz := NULL;
if quizname <> "" then
! quiz := traperror(eval(subject['GetQuiz',quizname]));
if type([quiz],[`aim/Quiz`]) then
quiztitle := quiz['Title'];
else
- quiz := NULL;
quiztitle := quizname;
fi;
--- 160,170 ----
quiz := NULL;
if quizname <> "" then
! try
! quiz := eval(subject['GetQuiz',quizname]);
! catch:
! end try;
if type([quiz],[`aim/Quiz`]) then
quiztitle := quiz['Title'];
else
quiztitle := quizname;
fi;
***************
*** 197,204 ****
fullqfile := cat(fulldir,"/questions/",qname,".m");
! question := traperror(eval(AimCache['Load',fullqfile]));
!
! if question = lasterror then
! err := lasterr;
err :=
cat(
--- 197,204 ----
fullqfile := cat(fulldir,"/questions/",qname,".m");
! try
! question := eval(AimCache['Load',fullqfile]);
! catch:
! err := StringTools[FormatMessage](lastexception[2..-1]);
err :=
cat(
***************
*** 210,217 ****
page['ActionLink',"Mark",[],__("Retry")]);
page['FillTemplate',"editsource" = editsource,"show" = err];
! RETURN();
! fi;
! if not(type(question,`aim/Question`)) then
err :=
cat(
--- 210,217 ----
page['ActionLink',"Mark",[],__("Retry")]);
page['FillTemplate',"editsource" = editsource,"show" = err];
! return();
! end try;
! if not(type([question],[`aim/Question`])) then
err :=
cat(
***************
*** 224,228 ****
"\n</pre><br/>\n");
page['FillTemplate',"editsource" = editsource,"show" = err];
! RETURN();
fi;
--- 224,228 ----
"\n</pre><br/>\n");
page['FillTemplate',"editsource" = editsource,"show" = err];
! return();
fi;
***************
*** 245,252 ****
p["QuestionSeed"] := sprintf("%d",seed);
! vrsion := traperror(eval(question['MakeVersion',seed,"",0]));
!
! if vrsion = lasterror then
! err := lasterr;
err :=
cat(
--- 245,252 ----
p["QuestionSeed"] := sprintf("%d",seed);
! try
! vrsion := eval(question['MakeVersion',seed,"",0]);
! catch:
! err := StringTools[FormatMessage](lastexception[2..-1]);
err :=
cat(
***************
*** 263,269 ****
"</pre><br/>\n";
page['FillTemplate',"editsource" = editsource,"show" = err];
! RETURN();
! elif not(type(vrsion,`aim/Question/Version`)) then
err :=
--- 263,270 ----
"</pre><br/>\n";
page['FillTemplate',"editsource" = editsource,"show" = err];
! return();
! end try;
! if not(type([vrsion],[`aim/Question/Version`])) then
err :=
***************
*** 334,344 ****
(p["Action"] = "TryRightAnswer"));
! instance :=
! traperror(eval(
! `aim/Question/MakeInstance/Recursive`(
! vrsion,rawtable,table([]),`try/Question/Context`,userightans)));
!
! if instance = lasterror then
! err := lasterr;
err :=
cat(
--- 335,345 ----
(p["Action"] = "TryRightAnswer"));
! try
! instance :=
! eval(
! `aim/Question/MakeInstance/Recursive`(
! vrsion,rawtable,table([]),`try/Question/Context`,userightans));
! catch:
! err := StringTools[FormatMessage](lastexception[2..-1]);
err :=
cat(
***************
*** 355,361 ****
"\n</pre>\n";
page['FillTemplate',"editsource" = editsource,"show" = err];
! RETURN();
!
! elif not(type(instance,`aim/Question/Instance`)) then
err :=
--- 356,363 ----
"\n</pre>\n";
page['FillTemplate',"editsource" = editsource,"show" = err];
! return();
! end try;
!
! if not(type(instance,`aim/Question/Instance`)) then
err :=
Index: Quiz.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/try/Quiz.mpl,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -d -r1.5 -r1.5.2.1
*** Quiz.mpl 28 Sep 2003 09:08:21 -0000 1.5
--- Quiz.mpl 31 Mar 2005 12:38:15 -0000 1.5.2.1
***************
*** 12,17 ****
):
- `Package/Dependencies` := [];
-
######################################################################
--- 12,15 ----
***************
*** 190,200 ****
quizname := p["QuizName"];
- quiz := traperror(eval(subject['GetQuiz',quizname]));
! if quiz = lasterror or not(type(quiz,`aim/Quiz`)) then
page['SetError',
__("Could not load quiz %A in subject %A."),
quizname,p["SubjectName"]];
! RETURN();
fi;
--- 188,203 ----
quizname := p["QuizName"];
! quiz := NULL;
! try
! quiz := eval(subject['GetQuiz',quizname]);
! catch:
! end try;
!
! if not(type([quiz],[`aim/Quiz`])) then
page['SetError',
__("Could not load quiz %A in subject %A."),
quizname,p["SubjectName"]];
! return();
fi;
***************
*** 221,226 ****
for i to numrows do
for j to numcols do
! cell := traperror(`aim/EntryHint`(rightans[i,j]));
! if cell = lasterror then cell := ""; fi;
rawans := rawans,cell;
if j < numcols then rawans := rawans,"|"; fi;
--- 224,232 ----
for i to numrows do
for j to numcols do
! try
! cell := `aim/EntryHint`(rightans[i,j]);
! catch:
! cell := "";
! end try;
rawans := rawans,cell;
if j < numcols then rawans := rawans,"|"; fi;
|