workflow-core icon indicating copy to clipboard operation
workflow-core copied to clipboard

How to get step errors using SQL provider

Open sorengranfeldt opened this issue 3 years ago • 3 comments

I'm building a workflow host with GraphQL webapi on top to be able to start/stop and get status of running workflows. I want to display errors and other information on the workflows and steps.

How do you access step error / execution errors using the SQL provider? Cant seem to find any methods for that.

sorengranfeldt avatar Nov 05 '22 09:11 sorengranfeldt

There are none. I had to reimplement the Npgsql persistence interface to have a DbContext to freely use and access data.

axelgenus avatar Jun 12 '23 14:06 axelgenus

You can get the DbContext like this:

builder.Services.AddScoped<IWorkflowDbContextFactory, SqlContextFactory>(sp => new SqlContextFactory(@"Data Source=.\SQLEXPRESS;Initial Catalog=WorkflowCore;Integrated Security=true;Encrypt=false", null));

var app = builder.Build();

app.MapPost("/workflows/search", async ([FromServices] IWorkflowDbContextFactory workflowDb, [FromBody] WorkflowQuery query, CancellationToken cancellationToken) =>
{
    var db = workflowDb.Build();

    var workflows = db.Set<PersistedWorkflow>().AsQueryable();

ErikEJ avatar Jun 13 '23 06:06 ErikEJ

Thx. I'll have a look into it. Had hoped that there be supported handles for this. Maybe in later versions

sorengranfeldt avatar Jun 14 '23 06:06 sorengranfeldt