# Use Hellang Middleware for Exception Handling
Date: 2024-05-10
# Status
Accepted
# Context
In our production environment, we need to ensure that detailed exception information is not exposed to the clients, as it can pose security risks and leak implementation details. However, we still want to provide meaningful error messages to the clients so they can understand what went wrong.
# Decision
We have decided to use the Hellang.Middleware.ProblemDetails package for handling exceptions in our APIs. This package allows us to capture exceptions and translate them into Problem Detail responses, which provide a standard format for error responses without exposing sensitive details.
# Consequences
By adopting this middleware, we will be able to provide consistent and meaningful error responses to our clients without risking the exposure of sensitive exception details. This will improve the security of our APIs and the experience for our clients. However, we will need to ensure that our exceptions are properly handled and translated into appropriate Problem Detail responses.
# References
- Hellang.Middleware.ProblemDetails GitHub (https://github.com/khellang/Middleware)