Skip to content

Commit 336fe2e

Browse files
committed
#190: Rethrow exception to ensure failed job status in Maestro notification
1 parent df6abdd commit 336fe2e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

modules/os2forms_forloeb/src/MaestroHelper.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,14 @@ public function processJob(Job $job): JobResult {
205205

206206
$submission = $this->webformSubmissionStorage->load($submissionID);
207207

208-
$this->sendNotification($notificationType, $submission, $templateTask, $maestroQueueID);
208+
try {
209+
$this->sendNotification($notificationType, $submission, $templateTask, $maestroQueueID);
210+
}
211+
catch (\Exception $e) {
212+
// Logging is done by the sendNotification method.
213+
// The job should be considered failed.
214+
return JobResult::failure($e->getMessage());
215+
}
209216

210217
return JobResult::success();
211218
}
@@ -261,12 +268,15 @@ private function sendNotification(
261268
}
262269
}
263270
catch (\Exception $exception) {
271+
// Log with context and rethrow exception.
264272
$this->error('Error sending notification: @message', $context + [
265273
'@message' => $exception->getMessage(),
266274
'handler_id' => 'os2forms_forloeb',
267275
'operation' => 'notification failed',
268276
'exception' => $exception,
269277
]);
278+
279+
throw $exception;
270280
}
271281
}
272282

0 commit comments

Comments
 (0)