Hi, in blazor wasm template there is a yellow error message shown at bottom of page.
when use other frontend tech we can use global error handler handle all ajax requests.
how can i do it with blazor? something like globalResponseFilter…
Hi, in blazor wasm template there is a yellow error message shown at bottom of page.
when use other frontend tech we can use global error handler handle all ajax requests.
how can i do it with blazor? something like globalResponseFilter…
You can control the UI layout of Blazor Errors in the #blazor-error-ui
section in your template, e.g:
There’s no global handlers for handling all HTTP Calls, but ServiceStack.Blazor Component API, i.e. that use ApiAsync
can be intercepted in BlazorConfig.OnApiErrorAsync
, that’s configured in your Program.cs, e.g:
BlazorConfig.Set(new()
{
//...
OnApiErrorAsync = (request,apiError) =>
{
BlazorConfig.Instance.GetLog()?.LogDebug("\n\nOnApiErrorAsync(): {0}", apiError.Error.GetDetailedError());
return Task.CompletedTask;
}
});