Skip to content

Commit

Permalink
Log caught exception in LocalGrpcListener's CreateInstance method (#2779
Browse files Browse the repository at this point in the history
)
  • Loading branch information
davidmrdavid authored Apr 5, 2024
1 parent 49d8656 commit 87239a1
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/WebJobs.Extensions.DurableTask/LocalGrpcListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Threading.Tasks;
using DurableTask.Core;
using DurableTask.Core.Entities;
using DurableTask.Core.Exceptions;
using DurableTask.Core.History;
using DurableTask.Core.Query;
using DurableTask.Core.Serializing.Internal;
Expand Down Expand Up @@ -161,10 +162,23 @@ public override Task<Empty> Hello(Empty request, ServerCallContext context)
InstanceId = instanceId,
};
}
catch (InvalidOperationException)
catch (OrchestrationAlreadyExistsException)
{
throw new RpcException(new Status(StatusCode.AlreadyExists, $"An Orchestration instance with the ID {request.InstanceId} already exists."));
}
catch (InvalidOperationException ex) when (ex.Message.EndsWith("already exists.")) // for older versions of DTF.AS and DTFx.Netherite
{
throw new RpcException(new Status(StatusCode.AlreadyExists, $"An Orchestration instance with the ID {request.InstanceId} already exists."));
}
catch (Exception ex)
{
this.extension.TraceHelper.ExtensionWarningEvent(
this.extension.Options.HubName,
functionName: request.Name,
instanceId: request.InstanceId,
message: $"Failed to start instanceId {request.InstanceId} due to internal exception.\n Exception trace: {ex}.");
throw new RpcException(new Status(StatusCode.Internal, $"Failed to start instance with ID {request.InstanceId}.\nInner Exception message: {ex.Message}."));
}
}

public async override Task<P.RaiseEventResponse> RaiseEvent(P.RaiseEventRequest request, ServerCallContext context)
Expand Down

0 comments on commit 87239a1

Please sign in to comment.