Index: trunk/tools/errors.pl
===================================================================
--- trunk/tools/errors.pl	(revision 27633)
+++ trunk/tools/errors.pl	(revision 27720)
@@ -102,4 +102,5 @@
 my %neb_entry;
 my %variance;
+my %error_reading;
 my %unknown;
 my %bad;
@@ -199,4 +200,9 @@
             last;
         }
+        if ($line =~ /Error reading .*, (\S+)/) {
+            $error_reading{$name} = $1;
+            $found = 1;
+            last;
+        }
     }
     $unknown{$name} = $log unless $found;
@@ -207,105 +213,33 @@
 print "\n";
 
-if (scalar keys %assertion) {
-    print "Assertion failures: " . ( scalar keys %assertion ) . "\n";
-    foreach my $name (keys %assertion) {
-        print "$name: $assertion{$name}\n";
-    }
-    print "\n";
+print_failure(\%assertion, "Assertion failures");
+print_failure(\%cannot_find_file, "'Cannot find file' errors");
+print_failure(\%unable_access, "'Unable to access file' errors");
+print_failure(\%failed_real_name, "'Failed to determine real name' errors");
+print_failure(\%failed_close, "'Failed to close' errors");
+print_failure(\%transparencies, "'Unable to perform statistics on transparencies' errors");
+print_failure(\%couldnt_open_file, "'Could not open file' errors");
+print_failure(\%failed_read, "'Failed to read' errors");
+print_failure(\%no_instances_available, "'No instances available' errors");
+print_failure(\%neb_entry, "'Neb entry not found' errors");
+print_failure(\%variance, "'Variance renormalisation' errors");
+print_failure(\%error_reading, "'Error reading' errors");
+print_failure(\%unknown, "Unknown errors");
+print_failure(\%bad, "Bad logs");
+
+### Pau.
+
+sub print_failure
+{
+    my $data = shift;           # Data
+    my $desc = shift;           # Description
+
+    if (scalar keys %$data) {
+        print "$desc: " . (scalar keys %$data) . "\n";
+        foreach my $name (keys %$data) {
+            print "$name: $$data{$name}\n";
+        }
+        print "\n";
+    }
+    return 1;
 }
-
-if (scalar keys %cannot_find_file) {
-    print "'Cannot find file' errors: " . ( scalar keys %cannot_find_file ) . "\n";
-    foreach my $name (keys %cannot_find_file) {
-        print "$name: $cannot_find_file{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %unable_access) {
-    print "'Unable to access file' errors: " . ( scalar keys %unable_access ) . "\n";
-    foreach my $name (keys %unable_access) {
-        print "$name: $unable_access{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %failed_real_name) {
-    print "'Failed to determine real name' errors: " . ( scalar keys %failed_real_name ) . "\n";
-    foreach my $name (keys %failed_real_name) {
-        print "$name: $failed_real_name{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %failed_close) {
-    print "'Failed to close' errors: " . ( scalar keys %failed_close ) . "\n";
-    foreach my $name (keys %failed_close) {
-        print "$name: $failed_close{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %transparencies) {
-    print "'Unable to perform statistics on transparencies' errors: " . ( scalar keys %transparencies ) . "\n";
-    foreach my $name (keys %transparencies) {
-        print "$name: $transparencies{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %couldnt_open_file) {
-    print "'Could not open file' errors: " . ( scalar keys %couldnt_open_file ) . "\n";
-    foreach my $name (keys %couldnt_open_file) {
-        print "$name: $couldnt_open_file{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %failed_read) {
-    print "'failed to read' errors: " . ( scalar keys %failed_read ) . "\n";
-    foreach my $name (keys %failed_read) {
-        print "$name: $failed_read{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %no_instances_available) {
-    print "'no instances available' errors: " . ( scalar keys %no_instances_available ) . "\n";
-    foreach my $name (keys %no_instances_available) {
-        print "$name: $no_instances_available{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %neb_entry) {
-    print "'neb entry not found' errors: " . ( scalar keys %neb_entry ) . "\n";
-    foreach my $name (keys %neb_entry) {
-        print "$name: $neb_entry{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %variance) {
-    print "'variance renormalisation' errors: " . ( scalar keys %variance ) . "\n";
-    foreach my $name (keys %variance) {
-        print "$name: $variance{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %unknown) {
-    print "Unknown errors: " . ( scalar keys %unknown ) . "\n";
-    foreach my $name (keys %unknown) {
-        print "$name: $unknown{$name}\n";
-    }
-    print "\n";
-}
-
-if (scalar keys %bad) {
-    print "Bad logs: " . ( scalar keys %bad ) . "\n";
-    foreach my $name (keys %bad) {
-        print "$name: $bad{$name}\n";
-    }
-    print "\n";
-}
