BitzArt.ApiExceptions
1.18.2
Prefix Reserved
See the version list below for details.
dotnet add package BitzArt.ApiExceptions --version 1.18.2
NuGet\Install-Package BitzArt.ApiExceptions -Version 1.18.2
<PackageReference Include="BitzArt.ApiExceptions" Version="1.18.2" />
paket add BitzArt.ApiExceptions --version 1.18.2
#r "nuget: BitzArt.ApiExceptions, 1.18.2"
// Install BitzArt.ApiExceptions as a Cake Addin #addin nuget:?package=BitzArt.ApiExceptions&version=1.18.2 // Install BitzArt.ApiExceptions as a Cake Tool #tool nuget:?package=BitzArt.ApiExceptions&version=1.18.2
General
This library defines ApiExceptions
that you can throw in your .Net applications.
Use with Asp.Net Core
You can always refer to this Asp.Net Core Sample project for guidance.
Setup:
Add nuget package:
dotnet add package BitzArt.ApiExceptions.AspNetCore
Add these 2 lines of code to your Program.cs
:
builder.Services.AddApiExceptionHandler(); // When configuring services
app.UseApiExceptionHandler(); // Before controllers
Usage:
Then, anywhere in your code, you can throw exceptions like:
throw ApiException.NotFound("sample 'not found' message");
This will generate an http response with appropriate status code:
Extra:
You can also add any custom fields:
These responses follow RFC7807: Problem Details standard.
Use outside of Asp.Net Core
To use ApiExceptions
in your applications, add this nuget package to your project:
dotnet add package BitzArt.ApiExceptions
The base package contains no handlers, so you will have to implement them yourself.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 is compatible. 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. |
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on BitzArt.ApiExceptions:
Package | Downloads |
---|---|
BitzArt.ApiExceptions.AspNetCore
ApiExceptions Asp.Net Core implementation |
|
BitzArt.CA.Core
Clean Architecture boilerplate. Core library |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.22.0 | 4,379 | 4/2/2024 |
1.21.2 | 142 | 4/2/2024 |
1.21.1 | 1,601 | 3/18/2024 |
1.21.0 | 148 | 3/18/2024 |
1.20.0 | 5,573 | 2/27/2024 |
1.19.0 | 529 | 1/30/2024 |
1.18.2 | 5,420 | 9/5/2023 |
1.18.1 | 338 | 9/5/2023 |
1.18.0 | 350 | 9/5/2023 |
1.17.1 | 1,048 | 8/18/2023 |
1.17.0 | 488 | 8/18/2023 |
1.16.0 | 669 | 8/14/2023 |
1.15.0 | 367 | 8/14/2023 |
1.14.1 | 378 | 8/10/2023 |
1.14.0 | 611 | 8/10/2023 |
1.13.0 | 544 | 8/10/2023 |
1.12.0 | 7,163 | 12/3/2022 |