Merge branch 'master' into arrays_in_appsettings

This commit is contained in:
Andrey Mishurinsky 2021-07-06 10:42:34 +03:00 committed by GitHub
commit 46dc29dfe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View file

@ -115,6 +115,28 @@ namespace Elsa.Activities.Http.Middleware
else
{
await workflowLaunchpad.ExecutePendingWorkflowAsync(pendingWorkflow, inputModel, cancellationToken);
pendingWorkflowInstance = await workflowInstanceStore.FindByIdAsync(pendingWorkflow.WorkflowInstanceId);
if (pendingWorkflowInstance is not null
&& pendingWorkflowInstance.WorkflowStatus == Elsa.Models.WorkflowStatus.Faulted
&& !httpContext.Response.HasStarted)
{
httpContext.Response.ContentType = "application/json";
httpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
var faultedResponse = JsonConvert.SerializeObject(new
{
errorMessage = $"Workflow faulted at {pendingWorkflowInstance.FaultedAt!} with error: {pendingWorkflowInstance.Fault!.Message}",
workflow = new
{
name = pendingWorkflowInstance.Name,
version = pendingWorkflowInstance.Version,
instanceId = pendingWorkflowInstance.Id
}
});
await httpContext.Response.WriteAsync(faultedResponse, cancellationToken);
}
}
}
}

View file

@ -1,3 +1,4 @@
using System.Collections.Generic;
using Elsa.Server.Hangfire.Extensions;
using Hangfire;
using Microsoft.AspNetCore.Builder;