Just log exceptions instead of spamming them in JobRunner
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 29 Jul 2014 22:55:28 +0000 (15:55 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 29 Jul 2014 23:01:40 +0000 (16:01 -0700)
* Even the CLI script already shows the error=X snippet.
  Logging the error should be enough, and avoids showing
  output when all we want is the JSON.

Change-Id: Iade412ea61cf427865d841ecab5498e4fcdb7e13

includes/jobqueue/JobRunner.php

index 0f585c7..9a4073f 100644 (file)
@@ -51,6 +51,9 @@ class JobRunner {
         *   - elapsed  : the total time spent running tasks in ms
         *   - reached  : the reason the script finished, one of (none-ready, job-limit, time-limit)
         *
+        * This method outputs status information only if a debug handler was set.
+        * Any exceptions are caught and logged, but are not reported as output.
+        *
         * @param array $options
         * @return array Summary response that can easily be JSON serialized
         */
@@ -110,7 +113,7 @@ class JobRunner {
                                        MWExceptionHandler::rollbackMasterChangesAndLog( $e );
                                        $status = false;
                                        $error = get_class( $e ) . ': ' . $e->getMessage();
-                                       $e->report(); // write error to STDERR and the log
+                                       MWExceptionHandler::logException( $e );
                                }
                                $timeMs = intval( ( microtime( true ) - $t ) * 1000 );
                                wfProfileOut( __METHOD__ . '-' . get_class( $job ) );