[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 18 Aug 2004 17:04:48 -0000


raeburn		Wed Aug 18 13:04:48 2004 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Add error logging for fetch_enrollment_query()
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.525 loncom/lonnet/perl/lonnet.pm:1.526
--- loncom/lonnet/perl/lonnet.pm:1.525	Thu Aug  5 12:59:29 2004
+++ loncom/lonnet/perl/lonnet.pm	Wed Aug 18 13:04:48 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.525 2004/08/05 16:59:29 albertel Exp $
+# $Id: lonnet.pm,v 1.526 2004/08/18 17:04:48 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3117,9 +3117,14 @@
     $cmd = &escape($cmd);
     my $query = 'fetchenrollment';
     my $queryid=&reply("querysend:".$query.':'.$dom.':'.$ENV{'user.name'}.':'.$cmd,$homeserver);
-    unless ($queryid=~/^\Q$host\E\_/) { return 'error: '.$queryid; }
+    unless ($queryid=~/^\Q$host\E\_/) { 
+        &logthis('fetch_enrollment_query: invalid queryid: '.$queryid.' for host: '.$host.' and homeserver: '.$homeserver.' context: '.$context.' '.$cnum); 
+        return 'error: '.$queryid;
+    }
     my $reply = &get_query_reply($queryid);
-    unless ( ($reply =~/^timeout/) || ($reply =~/^error/) ) {
+    if ( ($reply =~/^timeout/) || ($reply =~/^error/) ) {
+        &logthis('fetch_enrollment_query error: '.$reply.' for '.$dom.' '.$ENV{'user.name'}.' for '.$queryid.' context: '.$context.' '.$cnum);
+    } else {
         my @responses = split/:/,$reply;
         if ($homeserver eq $perlvar{'lonHostID'}) {
             foreach (@responses) {
@@ -3136,10 +3141,14 @@
                         my $filename = $dom.'_'.$key.'_'.$_.'_classlist.xml';
                         my $destname = $pathname.'/'.$filename;
                         my $xml_classlist = &reply("autoretrieve:".$filename,$homeserver);
-                        unless ($xml_classlist =~ /^error/) {
+                        if ($xml_classlist =~ /^error/) {
+                            &logthis('fetch_enrollment_query - autoretrieve error: '.$xml_classlist.' for '.$filename.' from server: '.$homeserver.' '.$context.' '.$cnum);
+                        } else {
                             if ( open(FILE,">$destname") ) {
                                 print FILE &unescape($xml_classlist);
                                 close(FILE);
+                            } else {
+                                &logthis('fetch_enrollment_query - error opening classlist file '.$destname.' '.$context.' '.$cnum);
                             }
                         }
                     }