Support multi-targeting and reformat exception classes

Updated the project file to support multi-targeting for both
.NET Framework 4.6.2 and .NET 8.0 by replacing `<TargetFramework>`
with `<TargetFrameworks>`.

Reformatted `AuthenticationFailedException` and
`NotFoundException` classes to use braces `{ }` for namespaces
and constructors for consistency. No functional changes were made
to the exception classes.
This commit is contained in:
2026-07-27 15:40:52 +02:00
parent 77e7c796fa
commit bf06b31656
3 changed files with 29 additions and 31 deletions

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net462;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

View File

@@ -1,17 +1,16 @@
namespace DigitalData.MessagingService.Domain.Exceptions;
namespace DigitalData.MessagingService.Domain.Exceptions
{
/// <summary>
/// Exception thrown when OAuth2 authentication fails.
/// </summary>
public class AuthenticationFailedException : Exception
{
public AuthenticationFailedException(string message)
: base(message)
public AuthenticationFailedException(string message) : base(message)
{
}
public AuthenticationFailedException(string message, Exception innerException)
: base(message, innerException)
public AuthenticationFailedException(string message, Exception innerException) : base(message, innerException)
{
}
}
}

View File

@@ -1,17 +1,15 @@
namespace DigitalData.MessagingService.Domain.Exceptions;
namespace DigitalData.MessagingService.Domain.Exceptions
{
/// <summary>
/// Exception thrown when a requested entity is not found.
/// </summary>
public class NotFoundException : Exception
{
public NotFoundException(string entityName, object key)
: base($"{entityName} with key '{key}' was not found.")
public NotFoundException(string entityName, object key) : base($"{entityName} with key '{key}' was not found.")
{
}
public NotFoundException(string message)
: base(message)
public NotFoundException(string message) : base(message)
{
}
@@ -20,3 +18,4 @@ public class NotFoundException : Exception
{
}
}
}