Skip to content

Commit 84df20a

Browse files
committed
Improve error handling in orchestration and activity triggers
Enhanced logging and error handling in Receive-CippOrchestrationTrigger by logging each activity task and handling exceptions during Wait-ActivityFunction. Also set $Output to $null on error in Receive-CippActivityTrigger to ensure proper state management.
1 parent 5db3bd7 commit 84df20a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Modules/CippEntrypoints/CippEntrypoints.psm1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,12 @@ function Receive-CippOrchestrationTrigger {
227227
$Output = $Output | Where-Object { $_.GetType().Name -eq 'ActivityInvocationTask' }
228228
if (($Output | Measure-Object).Count -gt 0) {
229229
Write-Information "Waiting for ($($Output.Count)) activity functions to complete..."
230-
$Results = Wait-ActivityFunction -Task @($Output)
230+
foreach ($Task in $Output) {
231+
Write-Information ($Task | ConvertTo-Json -Depth 10 -Compress)
232+
try {
233+
$Results = Wait-ActivityFunction -Task $Task
234+
} catch {}
235+
}
231236
} else {
232237
$Results = @()
233238
}
@@ -365,6 +370,7 @@ function Receive-CippActivityTrigger {
365370
} catch {
366371
Write-Error "Error in Receive-CippActivityTrigger: $($_.Exception.Message)"
367372
$Status = 'Failed'
373+
$Output = $null
368374
if ($TaskStatus) {
369375
$QueueTask.Status = 'Failed'
370376
$null = Set-CippQueueTask @QueueTask

0 commit comments

Comments
 (0)