[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm run.pm

matthew lon-capa-cvs@mail.lon-capa.org
Wed, 10 Apr 2002 14:46:30 -0000


matthew		Wed Apr 10 10:46:30 2002 EDT

  Modified files:              
    /loncom/xml	run.pm lonxml.pm 
  Log:
  Changes to make <script> errors print out cleaner.
  
  
Index: loncom/xml/run.pm
diff -u loncom/xml/run.pm:1.24 loncom/xml/run.pm:1.25
--- loncom/xml/run.pm:1.24	Fri Mar 29 13:21:00 2002
+++ loncom/xml/run.pm	Wed Apr 10 10:46:30 2002
@@ -1,6 +1,6 @@
 package Apache::run;
 #
-# $Id: run.pm,v 1.24 2002/03/29 18:21:00 albertel Exp $
+# $Id: run.pm,v 1.25 2002/04/10 14:46:30 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,7 +59,8 @@
   $@='';
   my (@result)=$safeeval->reval($code);
   if ($@ ne '' && !$hideerrors) {
-    &Apache::lonxml::error(":$@: occured while running :$code:");
+    # Put in newline to make display of code easier to read.
+    &Apache::lonxml::error(":$@: occured while running :\n$code");
   }
   if ( $#result < '1') {
     return $result[0];
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.165 loncom/xml/lonxml.pm:1.166
--- loncom/xml/lonxml.pm:1.165	Thu Apr  4 12:35:57 2002
+++ loncom/xml/lonxml.pm	Wed Apr 10 10:46:30 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.165 2002/04/04 17:35:57 matthew Exp $
+# $Id: lonxml.pm,v 1.166 2002/04/10 14:46:30 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1248,7 +1248,8 @@
 
 sub error {
   if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
-    print "<b>ERROR:</b>".join('<br />',@_)."<br />\n";
+    # If printing in construction space, put the error inside <pre></pre>
+    print "<b>ERROR:</b><pre>".join("\n",@_)."</pre>\n";
   } else {
     print "<b>An Error occured while processing this resource. The instructor has been notified.</b> <br />";
     #notify author