diff --git a/src/applications/metamta/PhabricatorMetaMTAWorker.php b/src/applications/metamta/PhabricatorMetaMTAWorker.php index af655f4e0f..dcc6a8dc5e 100644 --- a/src/applications/metamta/PhabricatorMetaMTAWorker.php +++ b/src/applications/metamta/PhabricatorMetaMTAWorker.php @@ -13,10 +13,6 @@ final class PhabricatorMetaMTAWorker protected function doWork() { $message = $this->loadMessage(); - if (!$message) { - throw new PhabricatorWorkerPermanentFailureException( - pht('Unable to load message!')); - } if ($message->getStatus() != PhabricatorMailOutboundStatus::STATUS_QUEUE) { return; @@ -32,7 +28,18 @@ final class PhabricatorMetaMTAWorker private function loadMessage() { $message_id = $this->getTaskData(); - return id(new PhabricatorMetaMTAMail())->load($message_id); + $message = id(new PhabricatorMetaMTAMail()) + ->load($message_id); + + if (!$message) { + throw new PhabricatorWorkerPermanentFailureException( + pht( + 'Unable to load mail message (with ID "%s") while preparing to '. + 'deliver it.', + $message_id)); + } + + return $message; } public function renderForDisplay(PhabricatorUser $viewer) { diff --git a/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php b/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php index 57a69843a4..c2276843db 100644 --- a/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php +++ b/src/infrastructure/daemon/workers/PhabricatorTaskmasterDaemon.php @@ -23,11 +23,15 @@ final class PhabricatorTaskmasterDaemon extends PhabricatorDaemon { $ex = $task->getExecutionException(); if ($ex) { if ($ex instanceof PhabricatorWorkerPermanentFailureException) { - $this->log( + // NOTE: Make sure these reach the daemon log, even when not + // running in "phd.verbose" mode. See T12803 for discussion. + $log_exception = new PhutilProxyException( pht( - 'Task %d was cancelled: %s', - $id, - $ex->getMessage())); + 'Task "%s" encountered a permanent failure and was '. + 'cancelled.', + $id), + $ex); + phlog($log_exception); } else if ($ex instanceof PhabricatorWorkerYieldException) { $this->log(pht('Task %s yielded.', $id)); } else {