Index: /trunk/pstamp/scripts/pstamp_finish.pl
===================================================================
--- /trunk/pstamp/scripts/pstamp_finish.pl	(revision 25121)
+++ /trunk/pstamp/scripts/pstamp_finish.pl	(revision 25122)
@@ -94,5 +94,5 @@
         if (!mkdir $out_dir) {
             print STDERR "cannot create output directory $out_dir";
-            stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
+            stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);
         }
 
@@ -102,10 +102,10 @@
         # request
         print STDERR "output directory $out_dir exists but is not a directory";
-        stop_request($req_id, $PS_EXIT_UNKNOWN_ERROR);
+        stop_request_and_exit($req_id, $PS_EXIT_UNKNOWN_ERROR);
     }
 
     if (! -e $req_file ) {
         print STDERR "request file $req_file is missing\n";
-        stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
+        stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
     }
 
@@ -117,5 +117,5 @@
         # point 
         print STDERR "failed to read request_file $req_file" ;
-        stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
+        stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
     }
 
@@ -154,14 +154,20 @@
                 print STDERR "Request $req_id produced no jobs.\n"
             }
+            # This should not happen. A fake job should be queued
+            stop_request_and_exit($req_id, $PS_EXIT_PROG_ERROR);
+if (0) {
             # No Jobs. 
             # XXXX Ouch. We need results for each rownum (each request specification) in the request file 
             # including those that produced no jobs.
-            # for now add an entry for rownum 1 and a phony error code.
+            # That did not happen for some reason.
+            # Add an entry with rownum 0 with an error code
             # we've included parse_error.txt to the fileset if it exists
+            # so the requester should get some idea what happened
             #
             my $rownum = 0;
-            my $fault = 42; # get a real error code
+            my $fault = $PSTAMP_NO_JOBS_QUEUED;
             print $tdf "$rownum|$fault|0|0|";
-            print $tdf "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|\n";
+            print $tdf "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|\n";
+}
         } else {
             my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");
@@ -186,5 +192,5 @@
             # on the data store since the product name is already used
             # maybe we could be more clever about this and choose a fileset name
-            stop_request($req_id, $fault);
+            stop_request_and_exit($req_id, $fault);
         }
 
@@ -196,5 +202,5 @@
             carp("failed to find imagedb for project: $project");
             if (!$fault) {
-                stop_request($req_id, $PS_EXIT_CONFIG_ERROR);
+                stop_request_and_exit($req_id, $PS_EXIT_CONFIG_ERROR);
             }
         }
@@ -287,5 +293,5 @@
 }
 
-sub stop_request {
+sub stop_request_and_exit {
     my $req_id = shift;
     my $fault  = shift;
