better error handling when a package change fails, RT#78504
[freeside.git] / FS / FS / Cron / bill.pm
index 2c9468b..30eb1ab 100644 (file)
@@ -123,7 +123,7 @@ sub bill {
             'priority' => 99, #don't get in the way of provisioning jobs
           };
           my $error = $queue->insert( 'custnum'=>$custnum, %args );
-
+          die $error if $error;
         }
 
       } else {
@@ -132,7 +132,12 @@ sub bill {
         if ( $disable_bill ) {
           $cust_main->collect( %args, 'debug' => $debug );
         } else {
-          $cust_main->bill_and_collect( %args, 'debug' => $debug );
+          my $error = $cust_main->bill_and_collect( %args, 'fatal' => 'return',
+                                                           'debug' => $debug, );
+          if ( $error ) {
+            $log->error($error);
+            warn $error; #die $error;
+          }
         }
 
       }