Skip to content

Configuration

Davide Benvegnù edited this page Nov 13, 2019 · 3 revisions

Middleware Configuration

BugGuardian.AspNetCore provides two different Middlewares to automatically intercept unhandled exception:

  • BugGuardianBugMiddleware: it reports the unhandled exception as Bug
  • BugGuardianTaskMiddleware: it reports the unhandled exception as Task

To use a middleware, you need to add the following line of code to the Startup.cs class within the Configure method:

app.UseBugGuardianBugExceptionHandler(Configuration.GetSection("BugGuardian"));

Of course, if you want the unhandled exception to be reported like a Task work item instead of a Bug work item, just register the second filter:

app.UseBugGuardianTaskExceptionHandler(Configuration.GetSection("BugGuardian"));

Both Middlewares have an overload that accepts an array of string to set custom tags on the reported Work Items:

app.UseBugGuardianBugExceptionHandler(Configuration.GetSection("BugGuardian"), new string[]{ "myTag1", "mytag2" });

WARNING: the only middleware components that should be above the BugGuardian one are Debug exception handlers and logging components.

Visit also the Parameters Configuration page to know how to proper set-up the needed parameters in the Web.config file

Clone this wiki locally