Skip to content

Commit

Permalink
Log orchestration error (#2657)
Browse files Browse the repository at this point in the history
  • Loading branch information
jviau authored Nov 8, 2023
1 parent 9f750eb commit b5c70e5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Worker.Extensions.DurableTask/FunctionsOrchestrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<FunctionsOrchestrator>().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;
Expand Down

0 comments on commit b5c70e5

Please sign in to comment.