diff --git a/CHANGELOG.md b/CHANGELOG.md index bbaf66e..3dbddf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,9 @@ before starting to add changes. Use example [placed in the end of the page](#exa ## [Unreleased] +- [PR-191](https://github.com/OS2Forms/os2forms/pull/191) + Re-throws exception to ensure failed status during Maestro notification job. + ## [4.1.0] 2025-06-03 - [PR-176](https://github.com/OS2Forms/os2forms/pull/176) diff --git a/modules/os2forms_forloeb/src/MaestroHelper.php b/modules/os2forms_forloeb/src/MaestroHelper.php index d2dd0c5..eaa6a5b 100644 --- a/modules/os2forms_forloeb/src/MaestroHelper.php +++ b/modules/os2forms_forloeb/src/MaestroHelper.php @@ -205,7 +205,14 @@ public function processJob(Job $job): JobResult { $submission = $this->webformSubmissionStorage->load($submissionID); - $this->sendNotification($notificationType, $submission, $templateTask, $maestroQueueID); + try { + $this->sendNotification($notificationType, $submission, $templateTask, $maestroQueueID); + } + catch (\Exception $e) { + // Logging is done by the sendNotification method. + // The job should be considered failed. + return JobResult::failure($e->getMessage()); + } return JobResult::success(); } @@ -261,12 +268,15 @@ private function sendNotification( } } catch (\Exception $exception) { + // Log with context and rethrow exception. $this->error('Error sending notification: @message', $context + [ '@message' => $exception->getMessage(), 'handler_id' => 'os2forms_forloeb', 'operation' => 'notification failed', 'exception' => $exception, ]); + + throw $exception; } }