Files
adas-core/adas-core.Domain/Exceptions/UserNotFoundException.cs
T
2026-06-27 15:23:26 -07:00

33 lines
1.5 KiB
C#

using System.Net;
namespace adas_core.Domain.Exceptions;
/// <summary>
/// Represents a business exception that is thrown when a requested user cannot be found.
/// </summary>
/// <remarks>
/// Inherits from <see cref="BusinessException"/> to signal user lookup failures within the business domain.
/// </remarks>
public class UserNotFoundException : BusinessException
{
/// <summary>
/// Initializes a new instance of the <see cref="UserNotFoundException"/> class with a <see cref="HttpStatusCode.NotFound"/> status code and a message identifying the missing <paramref name="username"/>.
/// </summary>
/// <param name="username">The username of the user that could not be found.</param>
/// <!-- aidoc:v1 sig=3e9ae01 body=4448e1d -->
public UserNotFoundException(string username) :
base(HttpStatusCode.NotFound, $"USER with username {username} not found")
{
}
/// <summary>
/// Initializes a new instance of the <see cref="UserNotFoundException"/> class with the username that could not be found and a wrapped inner <see cref="Exception"/>.
/// </summary>
/// <param name="username">The username that was not found.</param>
/// <param name="exception">The inner <see cref="Exception"/> that caused this exception to be raised.</param>
/// <!-- aidoc:v1 sig=2ed5f9f body=4448e1d -->
public UserNotFoundException(string username, Exception exception) : base(
$"USER with username {username} not found", exception)
{
}
}