Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log orchestration error #2657

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading