Jonas Arcangel
Jonas Arcangel

Reputation: 1925

How to display error details within blazor-error-ui element in Blazor WebAssembly?

For my Blazor WebAssembly app, I would like to be able to display details of the error (message, stacktrace) within the blazor-error-ui element.

How do I do this?

Upvotes: 7

Views: 15716

Answers (1)

Mark3308
Mark3308

Reputation: 1333

The trouble with the blazor-error-ui is they are on the HTML index page which is not a Blazor component.

As a workaround you could create your own Blazor component and use Cascading Values to display the errors. Please see link https://nightbaker.github.io/gitflow/azure/piplines/2020/01/22/blazor-error-component/

You would of course have to handle the errors with a try catch block and populate the error message and stack trace into your custom Blazor component.

Seems a lot of work when all you have to do is press F12 and view the same in the developer tools.

Upvotes: 6

Related Questions