Franz.Common.Errors
1.6.14
See the version list below for details.
dotnet add package Franz.Common.Errors --version 1.6.14
NuGet\Install-Package Franz.Common.Errors -Version 1.6.14
<PackageReference Include="Franz.Common.Errors" Version="1.6.14" />
<PackageVersion Include="Franz.Common.Errors" Version="1.6.14" />
<PackageReference Include="Franz.Common.Errors" />
paket add Franz.Common.Errors --version 1.6.14
#r "nuget: Franz.Common.Errors, 1.6.14"
#:package Franz.Common.Errors@1.6.14
#addin nuget:?package=Franz.Common.Errors&version=1.6.14
#tool nuget:?package=Franz.Common.Errors&version=1.6.14
Franz.Common.Errors
A library for handling and standardizing errors and exceptions in .NET applications. This library simplifies error management, making it easier to implement structured and meaningful error responses.
- Current Version: 1.6.14
Features
- Custom Exceptions:
ForbiddenExceptionFunctionalExceptionNotFoundExceptionPreconditionFailedExceptionTechnicalExceptionUnauthorizedException
- Base Exception:
ExceptionBasefor creating custom exceptions with consistent behavior.
- Error Response:
ErrorResponsefor structuring API error responses.
Installation
Install the package using NuGet Package Manager or the .NET CLI:
dotnet add package Franz.Common.Errors
Usage
1. Handling Custom Exceptions
Each exception is tailored for specific error scenarios. Here's an example of using NotFoundException:
using Franz.Common.Errors;
public void FindResource(int id)
{
var resource = GetResourceById(id);
if (resource == null)
{
throw new NotFoundException($"Resource with ID {id} was not found.");
}
}
2. Returning Structured Error Responses
Use ErrorResponse to provide consistent error information in your APIs:
using Franz.Common.Errors;
public IActionResult HandleException(Exception ex)
{
var errorResponse = new ErrorResponse
{
StatusCode = 500,
Message = ex.Message,
Details = "Additional details about the error."
};
return StatusCode(errorResponse.StatusCode, errorResponse);
}
3. Creating Custom Exceptions
Extend the ExceptionBase class to create your own exceptions with additional metadata:
using Franz.Common.Errors;
public class CustomException : ExceptionBase
{
public CustomException(string message) : base(message) { }
}
Exception Types Overview
| Exception Type | Description |
|---|---|
ForbiddenException |
Use for actions the user is not permitted to perform. |
FunctionalException |
Represents a domain or business logic error. |
NotFoundException |
Indicates that a requested resource could not be found. |
PreconditionFailedException |
Indicates a failed precondition for the request. |
TechnicalException |
Represents an unexpected technical error. |
UnauthorizedException |
Indicates a lack of authorization to access a resource. |
Contributing
We welcome contributions! Please follow these steps:
- Clone the repository. @ https://github.com/bestacio89/Franz.Common/
- Create a new branch for your feature or bug fix.
- Submit a pull request for review.
License
This library is licensed under the MIT License. See the LICENSE file for more details.
Changelog
Version 1.2.065
- Upgrade to .NET 9
Version 1.3
- Upgraded to .NET 9.0.8
- Added new features and improvements
- Separated business concepts from mediator concepts
- Now compatible with both the in-house mediator and MediatR
Version 1.4.1
- ?? Introduced TestExceptions for chaos engineering & demos
BananaRepublicException(EN/FR)MonsterException(EN/FR)VodkaCoffeePotException(EN/FR)FriendlyReminderException(EN/FR)
- ?? Bilingual Support: every test exception available in English & French
- ?? Consistent API: wrapped under
TestExceptionsstatic class - ?? Purpose: make resilience demos, test failures, and dev workshops fun & obvious
- ?? No impact on production code � these are opt-in chaos exceptions
| 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
- No dependencies.
NuGet packages (9)
Showing the top 5 NuGet packages that depend on Franz.Common.Errors:
| Package | Downloads |
|---|---|
|
Franz.Common.Reflection
Shared utility library for the Franz Framework. |
|
|
Franz.Common.Business
Shared utility library for the Franz Framework. |
|
|
Franz.Common.Messaging
Shared utility library for the Franz Framework. |
|
|
Franz.Common.EntityFramework
Shared utility library for the Franz Framework. |
|
|
Franz.Common.Http
Shared utility library for the Franz Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.6.19 | 564 | 10/25/2025 |
| 1.6.15 | 599 | 10/20/2025 |
| 1.6.14 | 605 | 10/15/2025 |
| 1.6.3 | 611 | 10/9/2025 |
| 1.6.2 | 607 | 10/7/2025 |
| 1.5.9 | 637 | 9/24/2025 |
| 1.5.4 | 587 | 9/23/2025 |
| 1.5.3 | 592 | 9/21/2025 |
| 1.5.2 | 613 | 9/21/2025 |
| 1.5.0 | 606 | 9/21/2025 |
| 1.4.4 | 563 | 9/20/2025 |
| 1.3.14 | 651 | 9/18/2025 |
| 1.3.13 | 645 | 9/18/2025 |
| 1.3.5 | 626 | 9/17/2025 |
| 1.3.4 | 616 | 9/16/2025 |
| 1.3.3 | 644 | 9/16/2025 |
| 1.3.2 | 618 | 9/15/2025 |
| 1.3.1 | 413 | 9/12/2025 |
| 1.3.0 | 596 | 8/25/2025 |
| 1.2.65 | 512 | 3/3/2025 |
| 1.2.64 | 448 | 1/29/2025 |
| 1.2.63 | 587 | 1/27/2025 |
| 1.2.62 | 533 | 1/8/2025 |