CAPIEH.Abstractions 1.0.0-alpha

.NET 5.0 .NET Core 3.1 .NET Standard 2.0
This is a prerelease version of CAPIEH.Abstractions.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CAPIEH.Abstractions --version 1.0.0-alpha
NuGet\Install-Package CAPIEH.Abstractions -Version 1.0.0-alpha
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CAPIEH.Abstractions" Version="1.0.0-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CAPIEH.Abstractions --version 1.0.0-alpha
#r "nuget: CAPIEH.Abstractions, 1.0.0-alpha"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install CAPIEH.Abstractions as a Cake Addin
#addin nuget:?package=CAPIEH.Abstractions&version=1.0.0-alpha&prerelease

// Install CAPIEH.Abstractions as a Cake Tool
#tool nuget:?package=CAPIEH.Abstractions&version=1.0.0-alpha&prerelease

CAPIEH

Centralized API Exception handler

Build status

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
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net5.0

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CAPIEH.Abstractions:

Package Downloads
CAPIEH

A centralized exception handler with a unified response object for use with loose coupled dotnet Core API

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.10-alpha 136 11/29/2021
1.0.0-alpha 80 11/29/2021