Franz.Common.Errors
2.0.2
dotnet add package Franz.Common.Errors --version 2.0.2
NuGet\Install-Package Franz.Common.Errors -Version 2.0.2
<PackageReference Include="Franz.Common.Errors" Version="2.0.2" />
<PackageVersion Include="Franz.Common.Errors" Version="2.0.2" />
<PackageReference Include="Franz.Common.Errors" />
paket add Franz.Common.Errors --version 2.0.2
#r "nuget: Franz.Common.Errors, 2.0.2"
#:package Franz.Common.Errors@2.0.2
#addin nuget:?package=Franz.Common.Errors&version=2.0.2
#tool nuget:?package=Franz.Common.Errors&version=2.0.2
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: 2.0.2
- Part of the private Franz Framework ecosystem.
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
Version 1.6.20
- Updated to .NET 10.0
v2.0.1 � Internal Modernization
- Messaging and infrastructure refactored for async, thread-safety, and modern .NET 10 patterns.
- All APIs remain fully backward compatible.
- Tests, listeners, and pipeline components modernized.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- No dependencies.
NuGet packages (14)
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 |
|---|---|---|
| 2.0.2 | 334 | 3/30/2026 |
| 2.0.1 | 338 | 3/29/2026 |
| 1.7.8 | 413 | 3/2/2026 |
| 1.7.7 | 432 | 1/31/2026 |
| 1.7.6 | 444 | 1/22/2026 |
| 1.7.5 | 411 | 1/10/2026 |
| 1.7.4 | 425 | 12/27/2025 |
| 1.7.3 | 504 | 12/22/2025 |
| 1.7.2 | 503 | 12/21/2025 |
| 1.7.1 | 455 | 12/20/2025 |
| 1.7.0 | 583 | 12/16/2025 |
| 1.6.21 | 475 | 11/27/2025 |
| 1.6.20 | 474 | 11/24/2025 |
| 1.6.19 | 602 | 10/25/2025 |
| 1.6.15 | 640 | 10/20/2025 |
| 1.6.14 | 648 | 10/15/2025 |
| 1.6.3 | 648 | 10/9/2025 |
| 1.6.2 | 653 | 10/7/2025 |
| 1.5.9 | 668 | 9/24/2025 |
| 1.5.4 | 621 | 9/23/2025 |