AuroraScienceHub.Framework.Exceptions
10.0.5
Prefix Reserved
dotnet add package AuroraScienceHub.Framework.Exceptions --version 10.0.5
NuGet\Install-Package AuroraScienceHub.Framework.Exceptions -Version 10.0.5
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="AuroraScienceHub.Framework.Exceptions" Version="10.0.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AuroraScienceHub.Framework.Exceptions" Version="10.0.5" />
<PackageReference Include="AuroraScienceHub.Framework.Exceptions" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AuroraScienceHub.Framework.Exceptions --version 10.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AuroraScienceHub.Framework.Exceptions, 10.0.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AuroraScienceHub.Framework.Exceptions@10.0.5
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AuroraScienceHub.Framework.Exceptions&version=10.0.5
#tool nuget:?package=AuroraScienceHub.Framework.Exceptions&version=10.0.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AuroraScienceHub.Framework.Exceptions
Comprehensive exception library for .NET applications with standardized exception types for common scenarios.
Overview
Provides well-defined exception classes that follow best practices. All exceptions inherit from FrameworkException for consistent error handling.
Key Features
- Standardized Exceptions - Common exception types for typical scenarios
- Hierarchical Structure - All exceptions inherit from
FrameworkException - Validation Helpers - Built-in guard clauses and validation utilities
- Rich Context - Structured exception reasons with detailed information
Installation
dotnet add package AuroraScienceHub.Framework.Exceptions
Exception Types
ValidationException
// Basic validation
throw new ValidationException("Invalid input data");
// With guard clauses
ValidationException.ThrowIf(age < 0, "Age must be positive");
ValidationException.ThrowIfNot(email.Contains("@"), "Invalid email");
var user = ValidationException.ThrowIfNull(userInput, "User cannot be null");
// With validation reasons
var reasons = new ValidationExceptionReason();
reasons.Add("Email", "Invalid email format");
throw new ValidationException("Validation failed", reasons);
EntityNotFoundException
throw new EntityNotFoundException($"User {userId} not found");
AccessDeniedException
throw new AccessDeniedException("Insufficient permissions to delete resource");
UnexpectedException
throw new UnexpectedException("Unexpected state in payment processing");
Usage Example
public class UserService
{
public User GetUser(int id)
{
var user = _repository.FindById(id);
if (user == null)
throw new EntityNotFoundException($"User {id} not found");
return user;
}
public void CreateUser(string email, int age)
{
ValidationException.ThrowIfNull(email, "Email is required");
ValidationException.ThrowIf(age < 18, "User must be 18 or older");
// Create user...
}
}
Exception Handling
try
{
var result = _service.ProcessRequest(request);
return Ok(result);
}
catch (ValidationException ex)
{
return BadRequest(new { error = ex.Message, reasons = ex.Reason });
}
catch (EntityNotFoundException ex)
{
return NotFound(new { error = ex.Message });
}
catch (AccessDeniedException ex)
{
return Forbid(ex.Message);
}
License
See LICENSE file in the repository root.
Related Packages
AuroraScienceHub.Framework.AspNetCore- Automatic exception to HTTP response conversionAuroraScienceHub.Framework.Entities- Domain entity interfaces
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AuroraScienceHub.Framework.Exceptions:
| Package | Downloads |
|---|---|
|
AuroraScienceHub.Framework.Entities
Domain-driven design building blocks including entity interfaces, strongly-typed identifiers, specifications pattern, and auditing support. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.5 | 988 | 4/23/2026 |
| 10.0.4 | 131 | 4/23/2026 |
| 10.0.3 | 464 | 2/11/2026 |
| 10.0.2 | 511 | 1/29/2026 |
| 10.0.1 | 508 | 12/25/2025 |
| 10.0.0 | 465 | 12/11/2025 |
| 9.0.7 | 1,954 | 11/20/2025 |
| 9.0.6 | 235 | 11/15/2025 |
| 9.0.5 | 285 | 11/8/2025 |
| 9.0.4 | 250 | 10/24/2025 |
| 9.0.3 | 255 | 10/15/2025 |
| 9.0.2 | 238 | 10/15/2025 |
| 9.0.1 | 431 | 10/14/2025 |
| 9.0.1-workflow-test-2.17 | 152 | 10/14/2025 |