MgcFramework.Exceptions
9.1.0
dotnet add package MgcFramework.Exceptions --version 9.1.0
NuGet\Install-Package MgcFramework.Exceptions -Version 9.1.0
<PackageReference Include="MgcFramework.Exceptions" Version="9.1.0" />
<PackageVersion Include="MgcFramework.Exceptions" Version="9.1.0" />
<PackageReference Include="MgcFramework.Exceptions" />
paket add MgcFramework.Exceptions --version 9.1.0
#r "nuget: MgcFramework.Exceptions, 9.1.0"
#:package MgcFramework.Exceptions@9.1.0
#addin nuget:?package=MgcFramework.Exceptions&version=9.1.0
#tool nuget:?package=MgcFramework.Exceptions&version=9.1.0
MgcFramework Exceptions
MgcFramework Exceptions is a .NET class library that provides tools for handling exceptions in a centralized manner using middleware.
Project Structure
Definitions/
ExceptionsDefinition.cs
Dtos/
BadRequestException.cs
BusinessException.cs
InternalServerErrorException.cs
NotFoundException.cs
UnprocessableEntityException.cs
Middleware/
ErrorDetails.cs
ExceptionMiddleware.cs
ExceptionMiddlewareExtension.cs
Getting Started
Prerequisites
- .NET 9.0 SDK or later
Installation
To install the project dependencies, run the following command:
dotnet restore
Building the Project
To build the project, run the following command in the root directory:
dotnet build
Usage
ExceptionMiddleware
The ExceptionMiddleware
class provides a centralized way to handle exceptions in your application.
Example
using MgcFramework.Exceptions.Middleware;
using Microsoft.AspNetCore.Builder;
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.UseExceptionMiddleware();
ErrorDetails
The ErrorDetails
class represents the details of an error, including the error type and a list of error messages.
Example
var errorDetails = new ErrorDetails
{
ErrorType = "BadRequest",
Errors = new List<string> { "Invalid input data" }
};
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE
file for more details.
Author
Mtro. Christian Gómez Simón - [ChriisTKD]
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- Microsoft.AspNetCore.WebUtilities (>= 9.0.1)
- Serilog (>= 4.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.