You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by anupam-mangal September 18, 2024
I am using Elsa 3.2.0 for my Blazor WASM project that displays Elsa workflows using the ThemedComponentWrapper as below:
In ideal conditions this page loads perfectly fine with Elsa Workflows as created by the user. However, in case the server is not running, it keeps retrying for a while and finally throws an HttpRequestException (which is expected). The problem is that I could not find any way to catch this exception and handle it for my application to show a user friendly message instead of the yellow bar showing 'Unhandled Error' at the bottom of the screen.
I did not find anything about exceptions in the Elsa documentation. Also in the Elsa Studio code, I see that the calls to fetch the Workflow definitions or instance lists are not enclosed in a try catch block (i.e. exception handling is not present).
Any help on how to get hold of the HttpRequestException in the above page code would be appreciated. The full stack trace of the exception is as below:
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: TypeError: Failed to fetch
System.Net.Http.HttpRequestException: TypeError: Failed to fetch
---> TypeError: Failed to fetch
--- End of inner exception stack trace ---
at System.Net.Http.BrowserHttpInterop.<CancelationHelper>d__13`1[[System.Runtime.InteropServices.JavaScript.JSObject, System.Runtime.InteropServices.JavaScript, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
at System.Net.Http.BrowserHttpHandler.CallFetch(HttpRequestMessage request, CancellationToken cancellationToken, Nullable`1 allowAutoRedirect)
at System.Net.Http.BrowserHttpHandler.<SendAsync>g__Impl|53_0(HttpRequestMessage request, CancellationToken cancellationToken, Nullable`1 allowAutoRedirect)
at Microsoft.Extensions.Http.Logging.LoggingHttpMessageHandler.<SendCoreAsync>g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.PolicyHttpMessageHandler.SendCoreAsync(HttpRequestMessage request, Context context, CancellationToken cancellationToken)
at Polly.Retry.AsyncRetryEngine.<ImplementationAsync>d__0`1[[System.Net.Http.HttpResponseMessage, System.Net.Http, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
at Polly.AsyncPolicy`1.<ExecuteAsync>d__13[[System.Net.Http.HttpResponseMessage, System.Net.Http, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
at Microsoft.Extensions.Http.PolicyHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Elsa.Studio.Login.HttpMessageHandlers.AuthenticatingApiHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at Microsoft.Extensions.Http.Logging.LoggingScopeHttpMessageHandler.<SendCoreAsync>g__Core|5_0(HttpRequestMessage request, Boolean useAsync, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
at Refit.RequestBuilderImplementation.<>c__DisplayClass15_0`2.<<BuildCancellableTaskFuncForMethod>b__0>d[[Elsa.Api.Client.Shared.Models.PagedListResponse`1[[Elsa.Api.Client.Resources.WorkflowDefinitions.Models.WorkflowDefinitionSummary, Elsa.Api.Client, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null]], Elsa.Api.Client, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null],[Elsa.Api.Client.Shared.Models.PagedListResponse`1[[Elsa.Api.Client.Resources.WorkflowDefinitions.Models.WorkflowDefinitionSummary, Elsa.Api.Client, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null]], Elsa.Api.Client, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext() in /_/Refit/RequestBuilderImplementation.cs:line 331
--- End of stack trace from previous location ---
at Refit.Implementation.Generated.ElsaApiClientResourcesWorkflowDefinitionsContractsIWorkflowDefinitionsApi.global::Elsa.Api.Client.Resources.WorkflowDefinitions.Contracts.IWorkflowDefinitionsApi.ListAsync(ListWorkflowDefinitionsRequest request, Nullable`1 versionOptions, CancellationToken cancellationToken)
at Elsa.Studio.Workflows.Domain.Services.RemoteWorkflowDefinitionService.ListAsync(ListWorkflowDefinitionsRequest request, Nullable`1 versionOptions, CancellationToken cancellationToken)
at Elsa.Studio.Workflows.Components.WorkflowDefinitionList.WorkflowDefinitionList.<>c__DisplayClass40_0.<<ServerReload>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Elsa.Studio.Components.StudioComponentBase.<InvokeWithBlazorServiceContext>d__14`1[[System.Collections.Generic.List`1[[Elsa.Studio.Workflows.Components.WorkflowDefinitionList.WorkflowDefinitionList.WorkflowDefinitionRow, Elsa.Studio.Workflows, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()
at Elsa.Studio.Workflows.Components.WorkflowDefinitionList.WorkflowDefinitionList.ServerReload(TableState state)
at MudBlazor.MudTable`1.<InvokeServerLoadFunc>d__154[[Elsa.Studio.Workflows.Components.WorkflowDefinitionList.WorkflowDefinitionList.WorkflowDefinitionRow, Elsa.Studio.Workflows, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at MudBlazor.MudTable`1.<OnAfterRenderAsync>d__156[[Elsa.Studio.Workflows.Components.WorkflowDefinitionList.WorkflowDefinitionList.WorkflowDefinitionRow, Elsa.Studio.Workflows, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)
```</div>
The text was updated successfully, but these errors were encountered:
Discussed in #290
Originally posted by anupam-mangal September 18, 2024
I am using Elsa 3.2.0 for my Blazor WASM project that displays Elsa workflows using the ThemedComponentWrapper as below:
@page "/workflow-definitions"
@using Elsa.Studio.Workflows.Components.WorkflowDefinitionList
@code {
[Inject] NavigationManager NavigationManager { get; set; } = default!;
}
In ideal conditions this page loads perfectly fine with Elsa Workflows as created by the user. However, in case the server is not running, it keeps retrying for a while and finally throws an HttpRequestException (which is expected). The problem is that I could not find any way to catch this exception and handle it for my application to show a user friendly message instead of the yellow bar showing 'Unhandled Error' at the bottom of the screen.
I did not find anything about exceptions in the Elsa documentation. Also in the Elsa Studio code, I see that the calls to fetch the Workflow definitions or instance lists are not enclosed in a try catch block (i.e. exception handling is not present).
Any help on how to get hold of the HttpRequestException in the above page code would be appreciated. The full stack trace of the exception is as below:
The text was updated successfully, but these errors were encountered: