Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FloppyShelf/Problemize/llms.txt

Use this file to discover all available pages before exploring further.

Provides extension methods to configure services and middleware related to exception handling in your ASP.NET Core application.

Namespace

FloppyShelf.Problemize

UseExceptionHandling (services)

Configures the required services including problem details and exception handling.
public static void UseExceptionHandling(
    this IServiceCollection services,
    IStatusCodeMapper? statusCodeMapper = null)

Parameters

services
IServiceCollection
required
The service collection to configure.
statusCodeMapper
IStatusCodeMapper
default:"null"
Optional custom status code mapper. If not provided, the default StatusCodeMapper will be used.

Behavior

This method:
  • Configures problem details with automatic metadata (instance, requestId, activityId)
  • Registers the status code mapper as a singleton (custom or default)
  • Registers the ExceptionHandler service

Exceptions

  • ArgumentNullException: Thrown when services is null

Example

var builder = WebApplication.CreateBuilder(args);

// Use default status code mapper
builder.Services.UseExceptionHandling();

// Or provide a custom mapper
builder.Services.UseExceptionHandling(new CustomStatusCodeMapper());

UseExceptionHandling (app)

Configures the middleware pipeline to use exception handling and status code pages.
public static void UseExceptionHandling(this WebApplication app)

Parameters

app
WebApplication
required
The web application instance.

Behavior

This method:
  • Enables global exception handling middleware
  • Provides status code responses (e.g., 404 Not Found)

Exceptions

  • ArgumentNullException: Thrown when app is null

Example

var app = builder.Build();

app.UseExceptionHandling();

app.MapControllers();
app.Run();

Build docs developers (and LLMs) love