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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Wed, 29 Aug 2007 21:49:38 -0000


albertel		Wed Aug 29 17:49:38 2007 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - add the response id and part id to the error message BUG#5399
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.453 loncom/xml/lonxml.pm:1.454
--- loncom/xml/lonxml.pm:1.453	Wed Aug 22 15:02:06 2007
+++ loncom/xml/lonxml.pm	Wed Aug 29 17:49:38 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.453 2007/08/22 19:02:06 albertel Exp $
+# $Id: lonxml.pm,v 1.454 2007/08/29 21:49:38 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1620,12 +1620,28 @@
 }
 
 sub error {
+    my @errors = @_;
+
     $errorcount++;
+
+    if (defined($Apache::inputtags::part)) {
+	if ( @Apache::inputtags::response ) {
+	    push(@errors,
+		 &mt("This error occurred while processing response [_1] in part [_2]",
+		     $Apache::inputtags::response[-1],
+		     $Apache::inputtags::part));
+	} else {
+	    push(@errors,
+		 &mt("This error occurred while processing part [_1]",
+		     $Apache::inputtags::part));
+	}
+    }
+
     if ( &show_error_warn_msg() ) {
 	# If printing in construction space, put the error inside <pre></pre>
 	push(@Apache::lonxml::error_messages,
 	     $Apache::lonxml::warnings_error_header.
-	     "<b>ERROR:</b>".join("<br />\n",@_)."<br />\n");
+	     "<b>ERROR:</b>".join("<br />\n",@errors)."<br />\n");
 	$Apache::lonxml::warnings_error_header='';
     } else {
 	my $errormsg;
@@ -1635,7 +1651,10 @@
 	    $errormsg=&mt("An error occured while processing this resource. The author has been notified.");
 	}
 	my $host=$Apache::lonnet::perlvar{'lonHostID'};
-	my $msg = join('<br />',(@_,"The error occurred on host <tt>$host</tt>"));
+	push(@errors, "The error occurred on host <tt>$host</tt>");
+
+	my $msg = join('<br />', @errors);
+
 	#notify author
 	&Apache::lonmsg::author_res_msg($env{'request.filename'},$msg);
 	#notify course