From 362bdd285075fdba4f192cf582eb4f71b35bee32 Mon Sep 17 00:00:00 2001 From: Jacob Viau Date: Fri, 3 Nov 2023 10:25:56 -0700 Subject: [PATCH] Log orchestration error --- .../FunctionsOrchestrator.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs b/src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs index 30513336e..62cfae22d 100644 --- a/src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs +++ b/src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.Azure.Functions.Worker.Middleware; using Microsoft.DurableTask; +using Microsoft.Extensions.Logging; namespace Microsoft.Azure.Functions.Worker.Extensions.DurableTask; @@ -44,8 +45,19 @@ public FunctionsOrchestrator( this.contextBinding.Value = wrapperContext; this.inputContext.PrepareInput(input); - // This method will advance to the next middleware and throw if it detects an asynchronous execution. - await EnsureSynchronousExecution(this.functionContext, this.next, wrapperContext); + try + { + // This method will advance to the next middleware and throw if it detects an asynchronous execution. + await EnsureSynchronousExecution(this.functionContext, this.next, wrapperContext); + } + catch (Exception ex) + { + this.functionContext.GetLogger().LogError( + ex, + "An error occurred while executing the orchestrator function '{FunctionName}'.", + this.functionContext.FunctionDefinition.Name); + throw; + } // Set the raw function output as the orchestrator output object? functionOutput = this.functionContext.GetInvocationResult().Value;