I have a Blazor Server-Side app running with .NET 5.0
and I'm trying to switch from ElmahCore to Exceptional.
But I can't get it to log Blazor exceptions.
When I throw an exception in a MVC controller it gets logged, but if I throw one in e.g. OnAfterRenderAsync
nothing gets logged.
What do I need to configure to get Blazor exceptions logged with Exceptional?
Also in ElmahCore I could use ElmahExtensions.RiseError(exception);
to log an exception I catched/handled in code but still wanted to show up in the error-log. Is there something similar for Exceptional?
I configured Exceptional with the default configuration from HERE.
I downloaded the package first:
Next, add the Exceptional tag configuration to the appsettings.json file, which contains the connection string used to store errors in the database:
Registering AddExceptional service in ConfigureServices Method:
After adding ConfigureServices next, we are going to add “UseExceptional” middleware in Configure method.
Adding app.UseExceptional(); Middleware in Configure method to handle errors:
Then I wrote a throw exception
throw new NotImplementedException();
Then you can see the record:
According to the article you provided, it should be done.Which side did you have a problem with?