CAPIEH 1.0.0-alpha
See the version list below for details.
dotnet add package CAPIEH --version 1.0.0-alpha
NuGet\Install-Package CAPIEH -Version 1.0.0-alpha
<PackageReference Include="CAPIEH" Version="1.0.0-alpha" />
paket add CAPIEH --version 1.0.0-alpha
#r "nuget: CAPIEH, 1.0.0-alpha"
// Install CAPIEH as a Cake Addin #addin nuget:?package=CAPIEH&version=1.0.0-alpha&prerelease // Install CAPIEH as a Cake Tool #tool nuget:?package=CAPIEH&version=1.0.0-alpha&prerelease
CAPIEH
Centralized API Exception handler
CAPIEH is a package to centralize all the exception handling and create a unified response format.
It's build around a middleware that places a big try catch on your pipeline. If an error is caught, it will invoke your delegated ExceptionHandler to handle your exception the way you want.
It gives the benifit to add translations to your message, make use of error codes, set error types, set exception identifiers to track in your logging, and more ...
Get it on Nuget
The main package on nuget.org:
PM> Install-Package CAPIEH.Core
The abstractions containing apiResponse wrapping models:
Coming Soon
Usage
Registering dependencies
Registering the dependencies in an ASP.NET Core application, using Microsoft.Extensions.DependencyInjection, is pretty simple:
Set-up the ExceptionHandler Delegate
You propagate how how exceptions should be handled and / or returned as a response, by creating and pluging your own ExceptionHandler Delegate. You set this up as followed:
// EXAMPLE
Example of Generic API Response
A generic response message will look like this
{
"data": {
... Your data model
},
"error": {
"id": "Identifier to track inside the logging",
"message": "A generic or custom message",
"type": "exception types (application exception, validation exception, ... whatever you can make up)",
"code": "an exception code that can be used on the client to set/translate exception messages client side",
"info": object (optional object to add custom data to your client),
},
"status": "string",
"statusCode": 100 // HttpStatusCode
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- CAPIEH.Abstractions (>= 1.0.0-alpha)
- Microsoft.AspNetCore.Http (>= 2.2.2)
-
.NETStandard 2.0
- CAPIEH.Abstractions (>= 1.0.0-alpha)
- Microsoft.AspNetCore.Http (>= 2.2.2)
-
.NETStandard 2.1
- CAPIEH.Abstractions (>= 1.0.0-alpha)
- Microsoft.AspNetCore.Http (>= 2.2.2)
-
net5.0
- CAPIEH.Abstractions (>= 1.0.0-alpha)
- Microsoft.AspNetCore.Http (>= 2.2.2)
-
net6.0
- CAPIEH.Abstractions (>= 1.0.0-alpha)
- Microsoft.AspNetCore.Http (>= 2.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.10-alpha | 218 | 11/29/2021 |
1.0.0-alpha | 131 | 11/29/2021 |